Introduction to Elixir - A Background and the Primitive Types - Part One
utopian-io·@tensor·
0.000 HBDIntroduction to Elixir - A Background and the Primitive Types - Part One
<center> </center> #### Repository: https://github.com/elixir-lang/elixir #### What Will I Learn? - You will learn about the BEAM and the Erlang Ecosystem and how that relates to Elixir - You will learn about Elixir primitive types such as Numbers, Strings, Characters, Lists, Maps, Tuples and more - You will learn how to use IEX (The Interactive Elixir Shell) - You will learn about the Elixir compilation Pipeline - You will learn about primitive operations and functions in Elixir #### Requirements ##### System Requirements: - Elixir v1.8 requires Erlang 20.0 or later ##### OS Support for Elixir and Phoenix: - Mac OSx - Unix and Linux - Windows - Raspberry Pi - Docker ##### Required Knowledge - Some basic Programming Knowledge - An Elixir installation - VsCode or any other Text Editor ##### Resources for Elixir and Phoenix: - Elixir Website: https://elixir-lang.org - Elixir Installation Instructions: https://elixir-lang.org/install.html - Awesome Elixir Github: https://github.com/h4cc/awesome-elixir - Phoenix Website: https://phoenixframework.org/ - Phoenix Installation Instructions: https://hexdocs.pm/phoenix/installation.html - Elixir Documentation: https://elixir-lang.org/docs.html - Phoenix Documentation: https://hexdocs.pm/phoenix/Phoenix.html - LiveView Github Repository: https://github.com/phoenixframework/phoenix_live_view ##### Sources: - Elixir Image: https://elixir-lang.org #### Difficulty - Beginner #### Description In this Video Tutorial, we start a new series on the Elixir language. We talk about what the Elixir language is and how it came about. We discuss the technical aspects of the Elixir language and how it relates to the BEAM (Bogdan's Erlang Abstract Machine). We look at how Elixir is compiled into Erlang and we talk about the advantages that the BEAM gives us. We also look at the primitive types that exist in Elixir and how they work with simple operators. #### The Basic Architecture of the BEAM and Elixir In 1986, the Swedish telecom giant Ericsson developed the Erlang language and the BEAM. This system was devised at the core of the OTP or Open Telecom Platform and used primarily to automate Telephone switchboards. In 2011, an alternative syntax for the BEAM was released in the form of Elixir. Elixir was designed as a means to harness the power of the BEAM and the OTP system and make these systems more accessible to developers. <center>  </center> Above is an image of a few flow charts showing how Elixir compiles to the BEAM and how the BEAM works across multiple CPU cores. Elixir is an alternative syntax on the BEAM and so its able to completely harness the system. Elixir follows a few separate steps towards compilation than Erlang but these steps provide elixir with some nice features such as macros and full Erlang inter-opt. You could write a full Erlang program inside of an Elixir program and have it compile without issue. On the Beam everything is a process and these processes are strongly isolated. The Processes communicate with one another through the use of message passing which gives rise to the Actor Model. Each process is run on top of a set of schedulers which decide how these processes are distributed across each of the CPU Cores. The Beam itself only runs on a single thread but the schedulers are able to distribute the CPU threads of operation to the processes allowing the application to fully use a Multicore CPU. #### Elixir Primitive Types and Operations Elixir supports all of the primitive types from the Erlang system and it adds to these types to make them more accessible. There are the number types, integers and floats which also use simple operations. Elixir also makes use of Atoms which are alphanumeric constants that refer to themselves. Elixir also has a large amount of collection types; this includes Tuples, Singly linked Lists, Maps, Strings, Binaries, Bitstrings and CharLists. All of these collection types have their own pros and cons and are useful in the ecosystem. <center>  </center> Above we have examples of these elixir primitives. Each of the primitives contains a set of functions and operations that can be applied to them to execute commands. All values in Elixir are Immutable and these primitives are very efficient as immutable data in memory. The collection types also are immutable and when you change a portion of a collection, the parts that are unchanged still refer to the old collection. This means that pieces of memory can be reused in response to demand. Some of the types such as Strings and Charlists are actually built on top of some of the other types like Binaries and Bitstrings. There are also multiple ways to define these primitives thanks to the macro system in Elixir. Full Github Source Code can be found here: https://github.com/tensor-programming/intro-to-elixir #### Video Tutorial <iframe width="560" height="315" src="https://www.youtube.com/embed/GQVXyjYX1zA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> #### Curriculum ##### Related Phoenix Videos > - [Phoenix 1.3 Chat Application Tutorial](https://steemit.com/utopian-io/@tensor/intro-to-elixir-phoenix-framework-1-3-chat-application) > - [Phoenix 1.3 Contexts and Ecto Schemas](https://steemit.com/utopian-io/@tensor/intro-to-elixir-ecto-schemas-and-phoenix-contexts) ##### GraphQL Series > - [Phoenix 1.3 GraphQL API - Part 1](https://steemit.com/utopian-io/@tensor/intro-to-elixir-building-a-graphql-api-in-phoenix-1-3) > - [Phoenix 1.3 GraphQL API - Part 2](https://steemit.com/utopian-io/@tensor/intro-to-elixir-graphql-mutations-and-crud) > - [Phoenix 1.3 GraphQL API - Part 3](https://steemit.com/utopian-io/@tensor/intro-to-elixir-adding-authentication-to-a-graphql-api)
👍 tibra, jadabug, imisstheoldkanye, ezravandi, hdu, elviento, supu, xyzashu, mehta, minminlou, reazuliqbal, accelerator, garrettwallace, jacekw.dev, bukiland, profupuvrit, tabontbiho, contverbasys, hearcopini, icathadty1989, tgagtacontcon, faithgq, nabezlesi1986, buicondithe, chichsopurve, slitperhohar, magesogu1987, zoe561, nicontmarbui, sydneys9, taylor5d1cfhall, sesmocentpi, contsimilti, ocundhatfa, mcadevinar, moncia90, steemexpress, spiceboyz, leir, sciack, mattiarinaldoni, deusjudo, steemterview, steemitri, pataty69, luc.real, munhenhos, bhaski, pagliozzo, jack8831, amosbastian, tobias-g, ulockblock, helo, rufans, jaff8, asaj, buckydurddle, jinger, codingdefined, mirkosche, dedicatedguy, reportup, espoem, ascorphat, mops2e, piaristmonk, shammi, ydavgonzalez, rantar, sbi10, maxpatternman, steemitperu, suramerica, ajayyy, josephace135, turkishcrew, tdogvoid, techcoderx, drsensor, randomvlogs, criptoanarquista, properfraction, luisal314, isisfemale, samanyolu, sevecen, cansteem, sportmen, trteam, veronicacoli, arequipa, leviackerman, lujuria, sam-dmc, smvenezuela, arthurpendragon, shikataganai, makotoshishio, laverdad, jamzed, mcfarhat, achiron, sward, bawativi, artistslatam, mindark, zuur, miniature-tiger, luigi-tecnologo, acdream, loshcat, greenorange, clayjohn, pozyton, midun, tensor, steem-plus, zuerich, roy2016, yokunjon, utopian.trail, techslut, minersean, erikaflynn, jakipatryk, suesa, che-shyr, didic, elear, aussieninja, stem-espanol, daan, abh12345, tykee, silviu93, dakeshi, vishalsingh4997, zoneboy, mcyusuf, sargoon, darewealth, dongentle2, rollthedice, netizens, bflanagin, jk6276, dssdsds, jayplayco, ravensavage, mrsbozz, jk6276.mons, jaxson2011, rewarding, vanarchist, tsoldovieri, iamphysical, felixrodriguez, azulear, carloserp-2000, miguelangel2801, emiliomoron, tomastonyperez, elvigia, luiscd8a, elpdl, josedelacruz, joseangelvs, viannis, erickyoussif, yusvelasquez, ubaldonet, mary11, reinaseq, fran.frey, aleestra, giulyfarci52, lorenzor, ivymalifred, andrick, mirzantorres, jrevilla, alfonzoasdrubal, wilmer14molina, harry-heightz, eastmael, eliaschess333, dalz, alexs1320, scienceangel, yu-stem, cpufronz, alex-hm, amestyj, cyprianj, geadriana, steem-ua, newsrx, carlos84, ennyta, gaming.yer, evangelista.yova, jenniferjulieth, endopediatria, alix96, anaestrada12, douglimarbalzan, steem-familia, ingmarvin, elimao, chavas, asmeira, mgarrillogonzale, rubenp, jeferc, hirally, eugenialobo, jcmontilva, rodriguezr, marbely20, moyam, darys, sibaja, balcej, lmanjarres, anaka, benhurg, judisa, juddarivv, mariamo, kimmorales, loraine25, antunez25, uzcateguiazambra, steemstem, dna-replication, alexzicky, kevinwong, lemouth, enzor, robotics101, tristan-muller, effofex, de-stem, alexander.alexis, ludmila.kyriakou, fancybrothers, howo, esteemguy, fejiro, sco, rharphelle, shoganaii, terrylovejoy, olajidekehinde, real2josh, kingabesh, temitayo-pelumi, ibk-gabriel, purelyscience, javier.dejuan, bloom, samminator, abigail-dantes, gra, kenadis, maticpecovnik, stemng, dexterdev, geopolis, alexdory, francostem, lesmouths-travel, michaelwrites, deholt, stem.witness, jent, emmanuel293, traviseric, huilco, tuoficinavirtual, erikkun28, aalok, scoora82, alexworld, moniroy, praditya, kingnosa, amin-ove, coolbuddy, bobandtom, casiloko, mtfmohammad, faberleggenda, arconite, pflanzenlilly, tombstone, mountain.phil28, jasonbu, monie, intellihandling, steemzeiger, biomimi, kjaeger, felicenavidad, bitinvdig0, nunesso, doctor-cog-diss, cameravisual, lorasia, sapphire.app, gutenmorganism, mohaaking, gustavoagt, vaccinusveritas, corsica, zonguin, darkiche, teekingtv, joelagbo, menoski, mrnightmare89, emperorhassy, sembdelgado, curie, naturalproducts, cryptokrieg, phogyan, delegate.lafona, aboutyourbiz, makrotheblack, markmorbidity, morbyjohn, dashfit, bil.prag, nitego, niouton, schroders, clweeks, itchyfeetdonica, operahoser, szokerobert, joendegz, moksamol, thatsweeneyguy, stahlberg, bavi, hansmast, getrichordie, hardaeborla, neumannsalva, poodai, drmake, asonintrigue, whoib, gangstayid, niko3d, nigerian-yogagal, ilovecryptopl, clement.poiret, rhethypo, antigourmet, predict-crypto, lola-carola, gabrielatravels, chickenmeat, psygambler, gmedley, reaverza, pinksteam, mininthecity, cjunros, wstanley226, diebaasman, slickhustler007, pechichemena, reizak, zlatkamrs, trixie, annaabi, fiveboringgames, jlsplatts, gordon92, payger, trang, sarhugo, chrisluke, hotsteam, teukurival, jcalero, elsll, somegaming, blewitt, travisung, lekang, dokter-purnama, ambitiouslife, locikll, allcapsonezero, eurodale, cryptononymous, shayekh2, neneandy, jingis07, gabyoraa, reverseacid, nicephoto, patris, vact, hijosdelhombre, shortsegments, wallyt, hendrikdegrote, anwenbaumeister, alfatron777, map0226, yaelg, zest, tdre, giuato, smacommunity, paradigmprospect, peaceandwar, thescubageek, mahdiyari, lamouthe, vodonik, gpcx86, lmon, wackou, charlie777pt, iansart, longer, desikaamukkahani, jorcam, alvin0617, goodcontentbot, cojp, drifter1, moz333, jiujitsu, danaedwards, gracelbm, coinbrew, combatsports, shinedojo, lacher-prise, rival, massivevibration, benleemusic, mammasitta, eric-boucher, robertbira, kaczynski, jjay, ryuna.siege, nicole-st, hhtb, yomismosoy, goodway, kafupraise, egotheist, langford, steepup, wargof, guga34, lk666, xanderslee, cordeta, ivan-g, oghie, jonmagnusson, musicvoter, archaimusic, lillywilton, edprivat, lionsmane, themarkymark, utopian-io, jga, cryptouno, dicetime,