Question

Write a program using DrRacket: is a member of a list. (Can you explain everything) code...

Write a program using DrRacket:

is a member of a list.

(Can you explain everything) code must be designed from the scratches no library functions

(member 1 '(2 3 4 1 5)) => true

(member 1 '(2 3 4 (1) 5)) => false

Homework Answers

Answer #1

#lang racket
(define (member l lis)
(if (for/or ([i lis])
    (equal? i l)) (display "true") (display "false"))
)
(member 1 '(1,2,3,4,5))

If you have any doubts please comment and please don't dislike.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program using DrRacket is a member of a list (member 1 '(2 3 4...
Write a program using DrRacket is a member of a list (member 1 '(2 3 4 1 5)) => true (member 1 '(2 3 4 (1) 5)) => false
square the elements of a linear list of numbers (square ‘(1 -3 -5 7)) => (1...
square the elements of a linear list of numbers (square ‘(1 -3 -5 7)) => (1 9 25 49) using DrRacket The code has to be from scratch, no library functions. and kindly explain what each line of code is doing.
In DrRacket, is there any way I can change (list 1 (list 2 (list 3 4...
In DrRacket, is there any way I can change (list 1 (list 2 (list 3 4 5) 6 )7) to (list 1 2 3 4 5 6 7)?
Using C++ / provide code comments so I can understand. Create a simple linked list program...
Using C++ / provide code comments so I can understand. Create a simple linked list program to create a class list containing class node { void *info; node *next; public: node (void *v) {info = v; next = 0; } void put_next (node *n) {next = n;} node *get_next ( ) {return next;} void *get_info ( ) {return info;} }; Be able to initially fill the list. Provide functions to insert/append nodes and remove nodes from the linked list. Be...
This problem need to use DrRacket software. Racket Language. You must write each of the following...
This problem need to use DrRacket software. Racket Language. You must write each of the following scheme functions. You must use only basic scheme functions do not use third-party libraries to support any of your work. Do not use any function with side effects. Write a function (join-together L1 L2) that takes a sorted list (ascending) of integers L1 and a sorted list of elements L2 and returns a sorted list containing all elements of both L1 and L2. See...
How to code this in python Write a program that computes and prints the first 1000...
How to code this in python Write a program that computes and prints the first 1000 prime numbers - simply write out each prime number on a new line. In implementing this solution I want you to define 2 functions: is_prime which can be used to test whether a number is a prime (e.g. is_prime(17) returns True but is_prime(9) returns False) and compute_primes which will return an array (or Python list) of the first n primes where n is passed...
Program in Java 1- Write a code to remove continuous repeatitive elements of a Linked List....
Program in Java 1- Write a code to remove continuous repeatitive elements of a Linked List. Example: Given: -10 -> 3 -> 3 -> 3 -> 5 -> 6 -> 6 -> 3 -> 2 -> 2 -> NULL The answer: -10 -> 3 -> 5 -> 6 -> 3 -> 2 -> NULL
program in java 1- Write a code to remove continuous repeatitive elements of a Linked List....
program in java 1- Write a code to remove continuous repeatitive elements of a Linked List. Example: Given: -10 -> 3 -> 3 -> 3 -> 5 -> 6 -> 6 -> 3 -> 2 -> 2 -> NULL The answer: -10 -> 3 -> 5 -> 6 -> 3 -> 2 -> NULL
Program in Java 1- Write a code to remove continuous repeatitive elements of a Linked List....
Program in Java 1- Write a code to remove continuous repeatitive elements of a Linked List. Example: Given: -10 -> 3 -> 3 -> 3 -> 5 -> 6 -> 6 -> 3 -> 2 -> 2 -> NULL The answer: -10 -> 3 -> 5 -> 6 -> 3 -> 2 -> NULL
6) Write the Python Code which can answer the following questions (20 pts): a)Consider a program...
6) Write the Python Code which can answer the following questions (20 pts): a)Consider a program which contains a list of numbers from 1 to 10that are stored into a variable a. Create a program that will allow you to exchange the elements from variable a at position 0 and 7from within this list. b)Create a program that will access the last 5 elements of the variable a from step a.)
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT