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
What is "the last mile of broadband access"? Why is this a problem and what kind of impact does it have on the business world an
zavuch27 [327]

The last mile of broadband access is the last final step of Internet connectivity to the subscriber's home or office.

Explanation:

The last mile of broadband access is the last final step of Internet connectivity to the subscriber's home or office.

Copper wire -

  • popular choice,
  • less durable,
  • offers less bandwidth,
  • prone to interference,
  • cheaper

Alternative is to use Optical fiber connectivity -

  • more durable,
  • offers much higher bandwidth compared to copper wiring,
  • expensive

Business and personal users have to weigh the pros and cons of copper wiring and optical fiber based on above mentioned factors.

Business who can afford the cost can choose Optical Fiber connectivity especially if the business involves working with huge amount of data.

The needs of personal users can be sufficed by copper wiring.

5 0
3 years ago
Blending two or more colours is called​
krek1111 [17]

Answer:

shading?

Explanation:

Ombré /ˈɒmbreɪ/ (literally "shaded" in French) is the blending of one color hue to another, usually moving tints and shades from light to dark. It has become a popular feature for hair coloring, nail art, and even baking, in addition to its uses in home decorating and graphic design.

3 0
3 years ago
The hardware to keep the output data when finished is a
Bess [88]
I believe the answer is modem
4 0
3 years ago
To download a webpage, the web browser copies files and transfer them to your ____
Ganezh [65]

Computer is your best answer.


If you download the files, they will show up either on your computer home screen, or in the 'downloads' section of your computer files.



hope this helps

7 0
3 years ago
Read 2 more answers
What guidelines should you follow when adding graphics to your presentations?
Elena L [17]
B, C, and D are the correct answers.
3 0
3 years ago
Read 2 more answers
Other questions:
  • What can a folder on a computer contain?
    13·2 answers
  • What are some consequences of internet addiction​
    9·1 answer
  • Two students are discussing the flow of electricity. Student A says that voltage is a measure of the amount of electron flow in
    8·1 answer
  • Computers store temporary Internet files in the Recycle Bin. These files take up space and slow down a computer. Which tool can
    10·1 answer
  • Pinterest, a visual bookmarking Website, logs more than 14 terabytes of new data each day, which means its storage needs are con
    10·1 answer
  • Given that Apache and Internet Information Services (IIS) are the two most popular web application servers for Linux and Microso
    10·1 answer
  • ¡Hola! He visto en muchos comentarios de Twitter "svd" cuando alguien dice "dale fav a este Tweet y siganse entre ustedes" y en
    8·1 answer
  • Which similar computer network components connect multiple devices?
    7·1 answer
  • What number will be output by the console.log command on line 5?
    9·1 answer
  • What will be displayed after this code segment is run?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!