1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lions [1.4K]
3 years ago
11

Define a recursive function prefix that accepts a positive integer n and a list xs as input, and returns a list containing only

the first n elements in xs. - This function must have a recursive definition and does not use any library functions!

Mathematics
1 answer:
Sauron [17]3 years ago
6 0

Answer:

F# Code:

let rec prefix n list =

//Extracting head and tail elements

let valHead = (Listhead list)

let valTail = (Listtail list)

// Checking n value

match n with

| 0 -> []

| _ -> [valHead] at (prefix (n-1) valTail) // Creating list recursively

//Testing function

let lstT = [1; 2; 3; 4; 5]

printfn "%A" (prefix 3 lstT)

printfn "%A" (prefix 2 lstT)

printfn "%A" (prefix 4 lstT)

Step-by-step explanation: see attachment below for sample run

You might be interested in
Find the slope of the line through the pair of points
Tatiana [17]

Answer:

slope = \frac{11}{2}

Step-by-step explanation:

Calculate the slope m using the slope formula

m = (y₂ - y₁ ) / (x₂ - x₁ )

with (x₁, y₁ ) = (- 4, 7) and (x₂, y₂ ) = (- 6, - 4)

m = \frac{-4-7}{-6+4} = \frac{-11}{-2} = \frac{11}{2}

4 0
3 years ago
Join meeee on z.o.o.m<br><br> Code 733-2555-7073<br> Password CS4ah4
RoseWind [281]

Answer:

srry im at school

Step-by-step explanation:

8 0
3 years ago
Read 2 more answers
Six girls share 5 1/3 pounds of pretzel each one receive the same amount. However, Sue only eats half of her pretzels and leaves
Tpy6a [65]

Answer:

4/9 pounds

Step-by-step explanation:

5 1/3 pounds of pretzels divided equally for 6 girls would mean that each girl gets 8/9 pounds of pretzel.

If Sue ate half of the 8/9 pounds, that would equal to 4/9 pounds of pretzel.

7 0
3 years ago
What percent is $4.50 of $6.00?
arsen [322]
Whenever you see the phrase "what percent" in a question, immediately write down x/100. In this instance, you are going to have two fractions, x/100 = $4.50/ $6.00.

Next you cross multiply. $6x = $4.50 x 100
This simplifies down to 6x =450. Divide both sides by 6 and you get 75. This means 4.5 is 75% of 6. 

I hope this helps! Good Luck!
4 0
3 years ago
Read 2 more answers
Four friends grow groups of sunflowers.
Bezzdna [24]

Answer:

Did this for a different person who had the image, the answer is the third one or

1 1 2 2 3 6 is the flower sizes while 2 is the median and 2.5 is the average.

Step-by-step explanation:

BRAINLIEST PLZ

5 0
3 years ago
Other questions:
  • Free points, I want to do something good in life, people say im too nice but I don't think I am but I want to be really nice enj
    7·2 answers
  • An equilateral triangle is shown below. What is the value of x?
    13·1 answer
  • Chau made $216 for 12 hours of work. At the same rate, how much would he make for 8 hours of work?
    5·1 answer
  • Write down the next term in this sequence -1 2 7 14 23
    8·1 answer
  • What type of number is 37.9? <br><br> A. Real <br> B . Imaginary <br> C. Complex
    14·1 answer
  • Calculus II Question
    11·1 answer
  • 14 Calculate the mode from the following data: 7,8, 6, 5, 10, 11, 4, 5,2 b. 5: а. 3.' 4 6 с. d: 6​
    5·1 answer
  • Find the y-intercept of the line on the graph.<br><br> Enter the correct answer.
    7·1 answer
  • Can someone help me
    10·1 answer
  • Can someone please help me?<br> I will give brainliest
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!