পৃষ্ঠাসমূহ

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 - Lists

The List is a structure used to store a collection of data items. In Erlang, Lists are created by enclosing the values in square brackets.
Following is a simple example of creating a list of numbers in Erlang.

Example

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

start() -> 
   Lst1 = [1,2,3], 
   io:fwrite("~w~n",[Lst1]).
The output of the above example will be −

Output

[1 2 3]
Let us now discuss the various methods available for Lists. Note that the lists library needs to be imported for these methods to work.
S.No Method and Description
1 all Returns true if Pred(Elem) returns true for all elements Elem in List, otherwise false.
2 any Returns true if Pred(Elem) returns true for at least one element Elem in List.
3 append Returns a new list List3 which is made from the elements of List1 followed by the elements of List2.
4 delete Deletes an element from the list and returns a new list.
5 droplast Drops the last element of a List.
6 duplicate Returns a list which contains N copies of the term Elem
7 last Returns the last element of the list
8 max Returns the element of the list which has the maximum value.
9 member Checks if an element is present in the list or not.
10 min Returns the element of the list which has the minimum value.
11 merge Returns the sorted list formed by merging all the sub-lists of ListOfLists.
12 nth Returns the Nth element of List.
13 nthtail Returns the Nth tail of the List.
14 reverse Reverses a list of elements.
15 sort Sorts a list of elements.
16 sublist Returns a sublist of elements.
17 sum Returns the sum of elements in the list.

No comments:

Post a Comment