Write these functions in ML(SML) : Write a function dup to double each element of an integer list. One function only. dup([2,3,5]) → [2,2,3,3,5,5] Write a function dups to double each char of a string. Recursion must on list not string. dups("aabc") → "aaaabbcc" Write a function mid to keep elements of an integer list between 5 and 10. One function only. mid [12,3,6,4,5,1] → [6,5]

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write these in SML

 

  1. Write these functions in ML(SML) :
  • Write a function dup to double each element of an integer list. One function only.
    dup([2,3,5]) → [2,2,3,3,5,5]
  • Write a function dups to double each char of a string. Recursion must on list not string.
    dups("aabc") → "aaaabbcc"
  • Write a function mid to keep elements of an integer list between 5 and 10. One function only.
    mid [12,3,6,4,5,1] → [6,5] 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Fibonacci algorithm
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning