Function in Clojure that takes a list of n letters and returns a list

Angel

I need your help to write a function that takes a list of letters like ['a', 'b', 'c'] and returns another list of letters like ['a', 'b', 'b', 'c', 'c', 'c'], this is the first element is repeated only once the second element is repeated two times, the third element is repeated three times, etc. Thank you in advance!.

akond
(mapcat repeat (map inc (range)) ["a" "b" "c"])

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Function in Clojure that takes a list of n letters and returns a list

From Dev

Is there a function that takes a list and returns a list of duplicate elements in that list?

From Dev

a function that takes a list of integers as a parameter and returns a list of running totals

From Dev

Function that takes a list of strings and returns another specific list

From Dev

How to write a function that takes a positive integer N and returns a list of the first N natural numbers

From Dev

Python function that takes a list and returns a new list with unique elements of the first list

From Dev

Write a function that takes two lists, and returns True if the first list is the reverse of the same elements in the second list, and False otherwise

From Dev

Write a function that takes as a parameter a list of strings and returns a list containing the lengths of each of the strings

From Dev

Testing a function that takes an empty list

From Dev

function takes iterabls and return a list

From Dev

I want to write a function that takes a list and returns in ascending order with out using the sort built in function

From Dev

Is there a standard function in Clojure that takes an argument, ignores it and returns a constant?

From Dev

Apply a list of function to parameter, clojure

From Dev

Use list as Clojure function body

From Dev

function that given a list returns a list of list decreasing

From Dev

I was tasked with creating a function that swaps adjacent letters of a word and returns the list of the candidate words.

From Dev

Javascript: function which takes in object, and returns list of all numbers described in object

From Dev

A function that takes in both a list (myList) and a value (n) and checks whether or not the value is in that list

From Dev

A function that takes in both a list (myList) and a value (n) and checks whether or not the value is in that list

From Dev

(= [:a :b] (list :a :b)) returns true in clojure?

From Dev

(= [:a :b] (list :a :b)) returns true in clojure?

From Dev

How write a function that returns a list of 'n' functions based on an input

From Dev

Creating a function that takes a list or integer as argument (Python)

From Dev

Function that takes a string representing a filename as an argument. Function returns number of letters in the txt file

From Dev

Function returns an empty List in Spark

From Dev

Function that returns a list of tuples.

From Dev

Python function returns empty list

From Dev

function that gets an Int and returns a list

From Dev

Python function returns empty list

Related Related

  1. 1

    Function in Clojure that takes a list of n letters and returns a list

  2. 2

    Is there a function that takes a list and returns a list of duplicate elements in that list?

  3. 3

    a function that takes a list of integers as a parameter and returns a list of running totals

  4. 4

    Function that takes a list of strings and returns another specific list

  5. 5

    How to write a function that takes a positive integer N and returns a list of the first N natural numbers

  6. 6

    Python function that takes a list and returns a new list with unique elements of the first list

  7. 7

    Write a function that takes two lists, and returns True if the first list is the reverse of the same elements in the second list, and False otherwise

  8. 8

    Write a function that takes as a parameter a list of strings and returns a list containing the lengths of each of the strings

  9. 9

    Testing a function that takes an empty list

  10. 10

    function takes iterabls and return a list

  11. 11

    I want to write a function that takes a list and returns in ascending order with out using the sort built in function

  12. 12

    Is there a standard function in Clojure that takes an argument, ignores it and returns a constant?

  13. 13

    Apply a list of function to parameter, clojure

  14. 14

    Use list as Clojure function body

  15. 15

    function that given a list returns a list of list decreasing

  16. 16

    I was tasked with creating a function that swaps adjacent letters of a word and returns the list of the candidate words.

  17. 17

    Javascript: function which takes in object, and returns list of all numbers described in object

  18. 18

    A function that takes in both a list (myList) and a value (n) and checks whether or not the value is in that list

  19. 19

    A function that takes in both a list (myList) and a value (n) and checks whether or not the value is in that list

  20. 20

    (= [:a :b] (list :a :b)) returns true in clojure?

  21. 21

    (= [:a :b] (list :a :b)) returns true in clojure?

  22. 22

    How write a function that returns a list of 'n' functions based on an input

  23. 23

    Creating a function that takes a list or integer as argument (Python)

  24. 24

    Function that takes a string representing a filename as an argument. Function returns number of letters in the txt file

  25. 25

    Function returns an empty List in Spark

  26. 26

    Function that returns a list of tuples.

  27. 27

    Python function returns empty list

  28. 28

    function that gets an Int and returns a list

  29. 29

    Python function returns empty list

HotTag

Archive