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
Nuetrik [128]
3 years ago
6

Code the function (insertNth list N insValue) which constructs a new list by inserting the specified insValue into the list afte

r the Nth top-level value (relative to 1).Example:> (insertNth '(X Y Z) 2 'FUN)(X Y FUN Z)> (insertNth '(X Y Z) 4 'FUN)(X Y Z)
Computers and Technology
1 answer:
-BARSIC- [3]3 years ago
3 0

Answer:

Explanation:

Function algorithm is coded below

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

2. Replace in Function

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

(defun replace-all (string part replacement &key (test #'char=))

 "Returns a new string in which all the occurrences of the part is replaced with replacement."

 (with-output-to-string (out)

   (loop with part-length = (length part)

         for old-pos = 0 then (+ pos part-length)

         for pos = (search part string

                           :start2 old-pos

                           :test test)

         do (write-string string out

                          :start old-pos

                          :end (or pos (length string)))

         when pos do (write-string replacement out)

         while pos)))

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

3. Insert After

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

(defun insert-after (lst index newelt)

(push newelt (cdr (nthcdr index lst)))

lst)

(insert-after '(a c d) 0 'b) => (A B C D)

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

4. insertNth

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

(defun insertNth(number index list)

 (do ((head '() (list* (first tail) head))

      (tail list (rest tail))

      (index index (1- index)))

     ((zerop index)

      (nreconc head (list* (+ number (first tail))

                           (rest tail))))))

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

5. InsertAfterAll

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

(defun InsertAfterAll (a v)

  (if (null v) (cons a nil) (cons (car v) (endcons a (cdr v)))))

(endcons 'a '(b c d))

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

You might be interested in
Blender is used by which video game team member?
prohojiy [21]

Answer:

The 2nd one

Explanation:

6 0
3 years ago
6. The NADH and FADH2 produced during the Krebs cycle pass their electrons down the 7. __ __ __ __ __ __ __ __ __ __ __ __ __ __
AlladinOne [14]

Answer:

The NADH and FADH2 produced during the Krebs cycle pass the electrons down  electron transport chain in the mitochondria to generate more ATP molecules

Explanation:

FADH2 stands for Flavin adenine dinucleotide and NADH stands for Nicotinamide adenine dinucleotide.

Both are created from FAD and NAD+ through reduction-oxidation reactions in the Krebs cycle during respiration as explained below:

This cycle gives off small amounts of energy in the form of adenosine triphosphate, or ATP, and produces these compounds, FADH2 and NADH. The Krebs cycle is like a wheel. Every time it makes one full rotation, energy is created and released. As you can see from the diagram, the NAD+ and FAD are brought in at key points throughout the cycle and are attached to other electrons resulting in the formation of NADH and FADH2.

This energy is then shuttled off to be used by the cell, mostly for the continuation of cellular respiration.

As they are shuttled away, these two compounds are used to move electrons into the electron transport chain, the final stage of respiration. It is in this stage that most of the energy is created and released from the mitochondria (powerhouse of the cell).

Basically the NADH and FADH2 are affixed with electrons and tranfered to the inner membrane of the mitochondria. The travel down the electron transfer chain, releasing electrons they once had. Thereby releasing alot of energy in the process

3 0
3 years ago
_________________________ are people, places, and materials, either printed or non-printed, that can provide answers to inquirie
GalinKa [24]

Answer:

Information/knowledge resources

Explanation:

The process of looking for answers to questions that will lead to improved knowledge about a subject is known as an inquiry. The theories of enquiry includes abduction, induction, and deduction

An inquiry can provide the reasoning behind observation by making use of the theories of inquiry and sources that provide answers (information) about the (interrelated) events of the inquiry

Therefore, information and knowledge resources are the people, materials, and places, which can be in the printed, verbal, appearance form that have the capacity to proffer answers to inquiries

6 0
2 years ago
Which of the following will most likely result in a decrease in population?
balu736 [363]
The correct answer is B
4 0
2 years ago
Read 2 more answers
​a(n) ____ is a communications device that connects a communications channel such as the internet to a device such as a computer
marissa [1.9K]
Router? Modem? I have no ideas outside of those.
8 0
2 years ago
Other questions:
  • By which method is heat transferred through a metal <br> spoon?
    9·2 answers
  • what aspect should you consider before adding pictures to a document? you should structure the first before you search for a rel
    15·2 answers
  • Name some technologies that engineers create
    13·1 answer
  • In regard to protective actions for explosive devices, the area where the blast originates is referred to as ___________ perimet
    8·1 answer
  • If none of the contacts of a manual switch change status when the operator is activated, what is the most probable cause?
    9·1 answer
  • In Microsoft Word you can access the _______ command from the "Mini toolbar." 
    9·1 answer
  • I had tried to turn on Linux on the Chromebook but it's not working
    11·2 answers
  • A gui allows you to interact with objects on the screen such as icons and buttons true or false
    15·1 answer
  • During the data transmission there are chances that the data bits in the frame might get corrupted. This will require the sender
    8·1 answer
  • 5. What skill is unique to reading online?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!