পৃষ্ঠাসমূহ

Search Your Article

CS

 

Welcome to GoogleDG – your one-stop destination for free learning resources, guides, and digital tools.

At GoogleDG, we believe that knowledge should be accessible to everyone. Our mission is to provide readers with valuable ebooks, tutorials, and tech-related content that makes learning easier, faster, and more enjoyable.

What We Offer:

  • 📘 Free & Helpful Ebooks – covering education, technology, self-development, and more.

  • 💻 Step-by-Step Tutorials – practical guides on digital tools, apps, and software.

  • 🌐 Tech Updates & Tips – simplified information to keep you informed in the fast-changing digital world.

  • 🎯 Learning Support – resources designed to support students, professionals, and lifelong learners.

    Latest world News 

     

Our Vision

To create a digital knowledge hub where anyone, from beginners to advanced learners, can find trustworthy resources and grow their skills.

Why Choose Us?

✔ Simple explanations of complex topics
✔ 100% free access to resources
✔ Regularly updated content
✔ A community that values knowledge sharing

We are continuously working to expand our content library and provide readers with the most useful and relevant digital learning materials.

📩 If you’d like to connect, share feedback, or suggest topics, feel free to reach us through the Contact page.

Pageviews

Tuesday, January 31, 2017

Erlang - BIFS

BIFs are functions that are built into Erlang. They usually do tasks that are impossible to program in Erlang. For example, it’s impossible to turn a list into a tuple or to find the current time and date. To perform such an operation, we call a BIF.

Let’s take an example of how BIF’s are used −

Example

-module(helloworld). 
-export([start/0]). 

start() ->   
   io:fwrite("~p~n",[tuple_to_list({1,2,3})]), 
   io:fwrite("~p~n",[time()]).
The following things need to be noted about the above example −
  • In the first example, we are using the BIF called tuple_to_list to convert a tuple to a list.
  • In the second BIF function, we are using the time function to output the system time.
The output of the above program will be as follows −

Output

[1,2,3]
{10,54,56}
Let’s look at some of the more BIF functions available in Erlang.
S.No BIF Functions & Description
1 date This method returns the current system date.
2 byte_size This method returns the number of bytes contained in a Bitstring.
3 element The method returns the Nth element in the tuple.
4 float This method returns the float value of a particular number.
5 get The method returns the process dictionary as a list.
6 put This method is used to put a key,value pair in the process dictionary.
7 localtime The method is used to give the local date and time in the system.
8 memory Returns a list containing information about memory dynamically allocated by the Erlang emulator.
9 now This method returns the tuple {MegaSecs, Secs, MicroSecs} which is the elapsed time since 00:00 GMT, January 1, 1970.
10 ports Returns a list of all ports on the local node
11 processes Returns a list of process identifiers corresponding to all the processes currently existing on the local node.
12 universaltime Returns the current date and time according to Universal Time Coordinated (UTC).

No comments:

Post a Comment