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
Why is it important to follow a consistent naming convention for variables?
Vitek1552 [10]

Answer:

today I am going to be out for the job interview so if I will make it happen I am going to New Orleans this week to get the kids to work on the spot and I can get ready to go out to dinner and I can make a few more people

4 0
2 years ago
Which statement describes the primary purpose of JavaScript?
cupoosta [38]

a.The primary purpose of JavaScript is to enable features such as validation of forms before they are submitted to the server.

<u>Explanation:</u>

On web pages before submitting the day, end user has to do client validations such as whether data enter is correct data type,  so end user for  client side validation been eiher by VBSCRIPT (visual basic script language) or (JavaScript java script).  Internet explorer or Microsoft edge uses VBSCRIPT for web page validation.

For visual basic script languages end user should have enough knowledge   on visual basic programming languages. Same away for java script end user have enough knowledge on c language.

Both Scripts are used for client side validation on success of validation end user will submit web page form for next action. JavaScript is used in most of the browser including Microsoft explorer or Microsoft edge.

5 0
3 years ago
The website of an international human rights organization stores a large database of information and provides search functionali
pishuonlain [190]

Answer:

False

Explanation:

This statement is false because International human rights stores large database so its search functionality is not limited to the website.

8 0
3 years ago
Linux is not secure as it is difficult to detect bugs and fix<br> true or false plz reply
Mazyrski [523]

False.

Linux is the most secure operating system

8 0
3 years ago
In general, the pilot and _______ approaches are the most favored conversion approaches.
Karo-lina-s [1.5K]

Answer:

The correct approach is "Phased".

Explanation:

  • The pilot step requires just to validate the development's implementation goals and objectives and then when the SDMX objects were introduced to development, several perhaps all problems have indeed been detected as well as logged through so that they're being corrected either by the detailed technical advisory committee.
  • The staggered or phased approach towards deployment provides the time possible to obtain the very next knowledge on evaluation criteria, staff including diverse cultures such that the strategy produced could be customized accordingly.
6 0
3 years ago
Other questions:
  • Temporary storage location for cutting and pasting
    9·1 answer
  • Computers are often referred to as _____.
    15·1 answer
  • By default, windows does not display ____________________ in windows explorer.
    8·1 answer
  • Que Inventos Importantes se Crearon durante la edad de agua y viento
    11·1 answer
  • Click cell C6 in the Data worksheet and insert a column. Type Series Name in cell C6. Click cell C7 in the Data worksheet and in
    9·1 answer
  • What component uses thermal paste to attach the heat sink?
    13·1 answer
  • You are splitting up all your apples equally between 3 people. which statement below will calculate how many apples will be left
    12·1 answer
  • hãy lựa chọn một doanh nghiệp kinh doanh theo loại hình siêu thị việt nam em hãy tìm hiểu doanh nghiệp và thực hiện theo yêu cầu
    10·1 answer
  • The _______ within a story are the people and/or objects that the story is about
    5·2 answers
  • Blank are what make up the World Wide Web.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!