create account

Introduction to Elixir - A Background and the Primitive Types - Part One by tensor

View this thread on: hive.blogpeakd.comecency.com
· @tensor ·
$26.36
Introduction to Elixir - A Background and the Primitive Types - Part One
<center>![elixir.jpg](https://cdn.steemitimages.com/DQmVq7k7SesVgh7jun87JhmfG9JBcC2gtJUCbngRyMiHCcr/elixir.jpg)
</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>
![elixir-erlang.png](https://cdn.steemitimages.com/DQmRt2hHJ2GEF8tbt3wernWntehpgkEkP5Kq6RScnHKto6T/elixir-erlang.png)
</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>
![elixir_primitives.png](https://cdn.steemitimages.com/DQmXYrc92VRoSei978pq4ACSrtNAd3HbCPmXR6Tw7VfDWdB/elixir_primitives.png)
 </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) 
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 418 others
properties (23)
authortensor
permlinkintroduction-to-elixir---a-background-and-the-primitive-types---part-one
categoryutopian-io
json_metadata{"tags":["utopian-io","video-tutorials","steemstem","technology","programming"],"app":"steem-plus-app"}
created2019-04-24 20:54:54
last_update2019-04-24 20:54:54
depth0
children10
last_payout2019-05-01 20:54:54
cashout_time1969-12-31 23:59:59
total_payout_value19.840 HBD
curator_payout_value6.519 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6,179
author_reputation87,856,203,149,624
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries
0.
accountsteemplus-pay
weight100
1.
accountutopian.pay
weight500
max_accepted_payout100,000.000 HBD
percent_hbd10,000
post_id83,700,866
net_rshares56,022,812,276,965
author_curate_reward""
vote details (482)
@steem-plus ·
SteemPlus upvote
Hi, @tensor!

You just got a **6.49%** upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in [here](https://steemit.com/@steem-plus) to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.
properties (22)
authorsteem-plus
permlinkintroduction-to-elixir---a-background-and-the-primitive-types---part-one---vote-steemplus
categoryutopian-io
json_metadata{}
created2019-04-25 11:45:57
last_update2019-04-25 11:45:57
depth1
children0
last_payout2019-05-02 11:45:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length433
author_reputation247,952,188,232,400
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,733,450
net_rshares0
@steem-ua ·
#### Hi @tensor!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
**Feel free to join our [@steem-ua Discord server](https://discord.gg/KpBNYGz)**
properties (22)
authorsteem-ua
permlinkre-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190427t184453z
categoryutopian-io
json_metadata"{"app": "beem/0.20.19"}"
created2019-04-27 18:44:54
last_update2019-04-27 18:44:54
depth1
children0
last_payout2019-05-04 18:44:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length285
author_reputation23,214,230,978,060
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,853,901
net_rshares0
@steemstem ·
re-tensor-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190427t191414982z
<div class='text-justify'> <div class='pull-left'> <center> <br /> <img width='200' src='https://res.cloudinary.com/drrz8xekm/image/upload/v1553698283/weenlqbrqvvczjy6dayw.jpg'> </center>  <br/> </div> 

This post has been voted on by the **SteemSTEM** curation team and voting trail. It is elligible for support from <b><a href='https://www.steemstem.io/#!/@curie'>@curie</a></b>.<br /> 

If you appreciate the work we are doing, then consider supporting our witness [**stem.witness**](https://steemconnect.com/sign/account_witness_vote?approve=1&witness=stem.witness). Additional witness support to the [**curie witness**](https://steemconnect.com/sign/account_witness_vote?approve=1&witness=curie) would be appreciated as well.<br /> 

For additional information please join us on the [**SteemSTEM discord**]( https://discord.gg/BPARaqn) and to get to know the rest of the community!<br />

Please consider setting <b><a href='https://www.steemstem.io/#!/@steemstem'>@steemstem</a></b> as a beneficiary to your post to get a stronger support.<br />

Please consider using the <b><a href='https://www.steemstem.io'>steemstem.io</a></b> app to get a stronger support.</div>
properties (22)
authorsteemstem
permlinkre-tensor-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190427t191414982z
categoryutopian-io
json_metadata{"app":"bloguable-bot"}
created2019-04-27 19:14:18
last_update2019-04-27 19:14:18
depth1
children0
last_payout2019-05-04 19:14:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,174
author_reputation262,017,435,115,313
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,855,027
net_rshares0
@utopian-io ·
Hey, @tensor!

**Thanks for contributing on Utopian**.
We’re already looking forward to your next contribution!

**Get higher incentives and support Utopian.io!**
 Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via [SteemPlus](https://chrome.google.com/webstore/detail/steemplus/mjbkjgcplmaneajhcbegoffkedeankaj?hl=en) or [Steeditor](https://steeditor.app)).

**Want to chat? Join us on Discord https://discord.gg/h52nFrV.**

<a href='https://steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1'>Vote for Utopian Witness!</a>
properties (22)
authorutopian-io
permlinkre-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190427t222113z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-04-27 22:21:15
last_update2019-04-27 22:21:15
depth1
children0
last_payout2019-05-04 22:21:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length588
author_reputation152,955,367,999,756
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,860,755
net_rshares0
@yokunjon ·
$4.97
I thank you for your contribution. Here are my thoughts. Note that, my thoughts are my personal ideas on your post and they are not directly related to the review and scoring unlike the answers I gave in the questionnaire;

I like how you care about your viewers. It might seem very trivial but what you did at 2:13 is very important, at least for me. I usually do not like following tutorials. I did follow two tutorials for Python and left one without finishing it. So the way of your explaining is some kind of charming but I do not know the reason. Do not get it as flattering.

Elixir is kinda alien to me as you would expect. I only worked with Java, JavaScript and Python-like high-level languages so far, so it feels different. Basic concepts are similar but it is just different kind of beast. Forcing data to be immutable is a nice concept, so you do not have to remember which function mutates and which returns the result. I found that maps are similar to NamedTuples in Python but without initialization. It would be better to say Tuple-like dictionaries as there is no immutable dictionary in Python.

I am very interested in the series and waiting for the next parts of it. Thanks for your efforts again!

----
Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/guidelines), as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, [click here](https://review.utopian.io/result/9/1-1-1-2-2-1-1-1-2-).

---- 
Need help? Chat with us on [Discord](https://discord.gg/uTyJkNm).

[[utopian-moderator]](https://join.utopian.io/)
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authoryokunjon
permlinkre-tensor-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190427t182623866z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://join.utopian.io/guidelines","https://review.utopian.io/result/9/1-1-1-2-2-1-1-1-2-","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"}
created2019-04-27 18:26:24
last_update2019-04-27 18:26:24
depth1
children5
last_payout2019-05-04 18:26:24
cashout_time1969-12-31 23:59:59
total_payout_value3.816 HBD
curator_payout_value1.157 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,678
author_reputation19,266,807,595,513
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,853,127
net_rshares10,000,341,331,600
author_curate_reward""
vote details (24)
@buckydurddle ·
Well done @yokunjon. Very good comments. 
Cheers, 
Bucky
πŸ‘  
properties (23)
authorbuckydurddle
permlinkre-yokunjon-re-tensor-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190428t011150396z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["yokunjon"],"app":"steemit/0.1"}
created2019-04-28 01:11:51
last_update2019-04-28 01:11:51
depth2
children0
last_payout2019-05-05 01:11:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length56
author_reputation101,965,608,464,038
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,865,346
net_rshares19,510,170,810
author_curate_reward""
vote details (1)
@tensor ·
Thanks @yokunjon.  Its always good to hear feedback from a person who might not know the technology and is also sort of following along with the series.  Your feedback is always invaluable.
πŸ‘  
properties (23)
authortensor
permlinkre-yokunjon-re-tensor-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190427t185047793z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["yokunjon"],"app":"steemit/0.1"}
created2019-04-27 18:50:42
last_update2019-04-27 18:50:42
depth2
children0
last_payout2019-05-04 18:50:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length189
author_reputation87,856,203,149,624
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,854,159
net_rshares18,940,339,567
author_curate_reward""
vote details (1)
@utopian-io ·
Thank you for your review, @yokunjon! Keep up the good work!
πŸ‘  
properties (23)
authorutopian-io
permlinkre-re-tensor-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190427t182623866z-20190430t094641z
categoryutopian-io
json_metadata"{"app": "beem/0.20.17"}"
created2019-04-30 09:46:42
last_update2019-04-30 09:46:42
depth2
children0
last_payout2019-05-07 09:46:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length60
author_reputation152,955,367,999,756
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,999,282
net_rshares19,356,949,472
author_curate_reward""
vote details (1)
@yokunjon ·
properties (23)
authoryokunjon
permlinkre-yokunjon-re-tensor-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190427t183806120z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2019-04-27 18:38:03
last_update2019-04-27 18:38:03
depth2
children1
last_payout2019-05-04 18:38:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length61
author_reputation19,266,807,595,513
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,853,635
net_rshares26,729,837,789
author_curate_reward""
vote details (73)
@tensor ·
Yeah, just taking my time with writing the contributions because I haven't had much time.
πŸ‘  
properties (23)
authortensor
permlinkre-yokunjon-re-yokunjon-re-tensor-introduction-to-elixir---a-background-and-the-primitive-types---part-one-20190427t185110507z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2019-04-27 18:51:06
last_update2019-04-27 18:51:06
depth3
children0
last_payout2019-05-04 18:51:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length89
author_reputation87,856,203,149,624
root_title"Introduction to Elixir - A Background and the Primitive Types - Part One"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id83,854,173
net_rshares19,327,065,878
author_curate_reward""
vote details (1)