Please help me with a code in Scheme basically what i need is as below
A function (append) which takes an atom and a list and adds the element to the end of the list.
Example: (append 'A '(B C D)) -> (B C D A)

Any help will be appreciated

Scheme already has a function named append, which takes multiple lists as arguments and returns the concatenation of all the lists. So you should name your function something else, like append-element perhaps.

You can define your function by simply using the existing append function to concatenate the list you want to append to with another list containing only the item you want to append like this:

(define (append-element x xs)
  (append xs (list x)))
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.