Menu

[Solved]Emacs Lisp Write Function Insertl Takes Three Arguments Atoms New Old List Atoms Builds Li Q37260125

In EMACS Lisp:Write the function insertL which takes three arguments: theatoms new and old, and a list of atoms. It builds a list with newinserted to the left of the first occurrence of old.
Write the function occurN which takes two lists 11 and 12 and counts how many times an atom in 11 occurs in 12 Examples: (occWrite the function occurN which takes two lists 11 and 12 and counts how many times an atom in 11 occurs in 12 Examples: (occurN ‘(fudge ice cream) ‘(ice cream with fruit for dessert)) returns 2. (occurN ‘(fudge fruit) (ice cream with fruit for dessert)) returns 1. (fudge ice cream)) returns 0. Write the function dot-product of two vectors (ie., list of mumbers) 11 and 12 that multiplies corresponding numbers in 11 and 12 and builds a new number by summing the results. The vectors are of the same length Example: (dot-product , (1 23) , (3 24)) returns 19. Write the function subset which takes two lists 11 and 12 and returns true if 11 is a subset of 12 Examples: (subset ‘(1 2) (0 3 2 1)) is true (subset (1 2)(0 3 2 4)) is false (subset (0 3 2 1)) is true rite the function insertL which takes three arguments: the atoms new and old, and a list of atoms. It builds a list with new inserted to the left of the first occurrence of old. Example: (insertL ‘fudge ‘fruit ‘(ice cream with fruit for dessert)) returns (ice cream with fudge fruit for dessert) Write the function substall which takes three arguments: the atoms new and old, and a list of atoms. It builds a list in which all occurrences of old are replaced by new Examples: (substall ‘fudge ‘fruit(ice cream with fruit and more fruit)) returns (ice cream with fudge and more fudge) Write the function rember2 which takes two arguments: an atom a and a list of atoms 1 and removes the second occurrence of a in 1 Examples: (rember2 ‘fudge (ice cream with fruit for dessert)) returns (ice cream with fruit for dessert) Show transcribed image text Write the function occurN which takes two lists 11 and 12 and counts how many times an atom in 11 occurs in 12 Examples: (occurN ‘(fudge ice cream) ‘(ice cream with fruit for dessert)) returns 2. (occurN ‘(fudge fruit) (ice cream with fruit for dessert)) returns 1. (fudge ice cream)) returns 0. Write the function dot-product of two vectors (ie., list of mumbers) 11 and 12 that multiplies corresponding numbers in 11 and 12 and builds a new number by summing the results. The vectors are of the same length Example: (dot-product , (1 23) , (3 24)) returns 19. Write the function subset which takes two lists 11 and 12 and returns true if 11 is a subset of 12 Examples: (subset ‘(1 2) (0 3 2 1)) is true (subset (1 2)(0 3 2 4)) is false (subset (0 3 2 1)) is true rite the function insertL which takes three arguments: the atoms new and old, and a list of atoms. It builds a list with new inserted to the left of the first occurrence of old. Example: (insertL ‘fudge ‘fruit ‘(ice cream with fruit for dessert)) returns (ice cream with fudge fruit for dessert) Write the function substall which takes three arguments: the atoms new and old, and a list of atoms. It builds a list in which all occurrences of old are replaced by new Examples: (substall ‘fudge ‘fruit(ice cream with fruit and more fruit)) returns (ice cream with fudge and more fudge) Write the function rember2 which takes two arguments: an atom a and a list of atoms 1 and removes the second occurrence of a in 1 Examples: (rember2 ‘fudge (ice cream with fruit for dessert)) returns (ice cream with fruit for dessert)

Expert Answer


Answer to In EMACS Lisp: Write the function insertL which takes three arguments: the atoms new and old, and a list of atoms. It bu… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *