পৃষ্ঠাসমূহ

Search Your Article

CS

Pageviews

Monday, January 30, 2017

Elixir - Sigils

In this chapter, we are going to explore sigils, which are one of the mechanisms provided by the language for working with textual representations. Sigils start with the tilde (~) character which is followed by a letter (which identifies the sigil) and then a delimiter; optionally, modifiers can be added after the final delimiter.

Elixir - Comprehensions

List comprehensions are syntactic sugar for looping through enumerables in Elixir. In this chapter we'll use comprehensions for iteration and generation.

Elixir - Typespecs

Elixir is a dynamically typed language, so all types in Elixir are inferred by the runtime. Nonetheless, Elixir comes with typespecs, which are a notation used for declaring custom data types and declaring typed function signatures (specifications).

Elixir - Behaviours

Behaviours in Elixir (and Erlang) are a way to separate and abstract the generic part of a component (which becomes the behaviour module) from the specific part (which becomes the callback module). Behaviours provide a way to:

Elixir - Error Handling

Elixir has three error mechanisms: errors, throws and exits. Let us explore each of them.

Error

Errors (or exceptions) are used when exceptional things happen in the code. A sample error can be retrieved by trying to add a number into an string:
IO.puts(1 + "Hello")

Elixir - Macros

Macros are one of the most advanced and powerful features of Elixir. As with all advanced features of any language, macros shoild be used sparingly. They make it possible to perform powerful code transformations in compile time. Macros are a fairly complex subject, and it would take a small tutorial to explain it in depth. Here we'll just scratch the surface and get familiar with what macros are and how to use them.

Elixir - Libraries

Elixir provides excellent interoperability with Erlang libraries. Let us have a look at some of these libraries.

The binary module

The built-in Elixir String module handles binaries that are UTF-8 encoded. The binary module is useful when you are dealing with binary data that is not necessarily UTF-8 encoded. Let us look at an example:
# UTF-8
IO.puts(String.to_char_list("Ø"))

Data Structures & Algorithms - Overview

Data Structure is a systematic way to organize data in order to use it efficiently. Following terms are the foundation terms of a data structure.

Data Structures - Environment Setup

Try it Option Online

You really do not need to set up your own environment to start learning C programming language. Reason is very simple, we already have set up C Programming environment online, so that you can compile and execute all the available examples online at the same time when you are doing your theory work.

Data Structures - Algorithms Basics

Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output. Algorithms are generally created independent of underlying languages, i.e. an algorithm can be implemented in more than one programming language.

Data Structures - Asymptotic Analysis

Asymptotic analysis of an algorithm refers to defining the mathematical boundation/framing of its run-time performance. Using asymptotic analysis, we can very well conclude the best case, average case, and worst case scenario of an algorithm.

Data Structures - Greedy Algorithms

An algorithm is designed to achieve optimum solution for a given problem. In greedy algorithm approach, decisions are made from the given solution domain. As being greedy, the closest solution that seems to provide an optimum solution is chosen.