Difference between revisions of "Activity assignment 1"

From Marek Běhálek Wiki
Jump to navigation Jump to search
(Created page with "== Activity assignments == Implement following functions. There will be 5 points for each of these functions. # Create a function that gets a list of tuples (Int, Char). Th...")
 
Line 3: Line 3:
 
Implement following functions. There will be 5 points for each of these functions.
 
Implement following functions. There will be 5 points for each of these functions.
  
# Create a function that gets a list of tuples (Int, Char). This function tkaes these pair and for each of these pairs (n, a) generates a string where the character <code>a</code> is multiplied <code>n</code> times. The function result is a concatenation of these sub-strings.  
+
# Create a function that gets a list of tuples (Int, Char). This function takes these pair and for each of these pairs (n, a) generates a string where the character <code>a</code>
<syntaxhighlight lang="Haskell" >
+
  is multiplied <code>n</code> times. The function result is a concatenation of these sub-strings.
create :: [(Int, Char)] -> String
+
  <syntaxhighlight lang="Haskell" >
</syntaxhighlight>
+
  create :: [(Int, Char)] -> String
<syntaxhighlight lang="Haskell" class="myDark" >
+
  </syntaxhighlight>
create [(2,’a’), (3,’B’)] = “aaBBB”
+
  <syntaxhighlight lang="Haskell" class="myDark" >
</syntaxhighlight>
+
  create [(2,'a'), (3,'B')] = "aaBBB"
 +
  </syntaxhighlight>
 +
# Create a function that gets a list of tuples (Int, Char). This function tkaes these pair and for each of these pairs (n, a) generates a string where the character <code>a</code>  
 +
  is multiplied <code>n</code> times. The function result is a concatenation of these sub-strings.  
 +
  <syntaxhighlight lang="Haskell" >
 +
  create :: [(Int, Char)] -> String
 +
  </syntaxhighlight>
 +
  <syntaxhighlight lang="Haskell" class="myDark" >
 +
  create [(2,'a'), (3,'B')] = "aaBBB"
 +
  </syntaxhighlight>

Revision as of 13:44, 8 November 2019

Activity assignments

Implement following functions. There will be 5 points for each of these functions.

  1. Create a function that gets a list of tuples (Int, Char). This function takes these pair and for each of these pairs (n, a) generates a string where the character a
 is multiplied n times. The function result is a concatenation of these sub-strings. 
  create :: [(Int, Char)] -> String
  create [(2,'a'), (3,'B')] = "aaBBB"
  1. Create a function that gets a list of tuples (Int, Char). This function tkaes these pair and for each of these pairs (n, a) generates a string where the character a
 is multiplied n times. The function result is a concatenation of these sub-strings. 
  create :: [(Int, Char)] -> String
  create [(2,'a'), (3,'B')] = "aaBBB"