Scheme/DrRacket Help
1
Name:
Anonymous
2012-12-02 15:29
Does anyone know how to do this using one of these: filter, map, foldr? We're not allowed to use recursion.
Write a Scheme function find-common (using at least one abstract list function), which consumes two lists of numbers lst1, and lst2 and produces a list of all elements of lst1 that appear in lst2, with the same order of lst1 . Some examples follow:
(find-common empty empty) => empty
(find-common (list 2 3 56 23 3) (list 3 2 4 56 4 14)) => (list 2 3 56 3)
(find-common (list 56 29) (list 156 329 43)) => empty
2
Name:
Anonymous
2012-12-02 15:31
You've made like 3 homework threads today.
3
Name:
Anonymous
2012-12-02 15:39
use foldr to represent recursion. now go away
4
Name:
Anonymous
2012-12-02 15:41
I don't even know Lisp and I can think of two or three ways of solving this.
5
Name:
Anonymous
2012-12-02 15:45
(elementary problem! )> ᕦ(ò_óˇ)ᕤ
6
Name:
Anonymous
2012-12-02 15:46
>>5
if its such an elementary problem, then help me? please...
7
Name:
Anonymous
2012-12-02 15:48
>>6
No, it's so elementary that you should solve it yourself. You're as dumb as /g/, holy shit.
8
Name:
Anonymous
2012-12-02 15:52
If you're honestly struggling with this then good luck with any higher-level material.
Asking someone to solve this for you will only ensure your failure later.
9
Name:
Anonymous
2012-12-02 15:56
I solved it with the use of lambda, but I cannot use lambda yet.
10
Name:
Anonymous
2012-12-02 16:12
Bump
11
Name:
Anonymous
2012-12-02 16:19
Is there a way to do this without using lambda?
(define (find-common lst1 lst2)
(filter (lambda (x) (member x lst2)) lst1))
12
Name:
Anonymous
2012-12-02 16:35
13
Name:
Anonymous
2012-12-02 16:59
>>11
Why are you so fucking stupid?
14
Name:
Anonymous
2012-12-02 17:01
>>13
Why do you think I'm stupid?
15
Name:
Anonymous
2012-12-02 17:15
>>14
Because you're asking us how can you replace a lambda by something that's not a lambda. I don't understand why you're making such a dumb question, I don't even know why you know what a lambda is.
16
Name:
Anonymous
2012-12-02 17:17
>>14
You are stupid because you spam
/prog/ all day with shit and then ask for help with babby's first exercise.
17
Name:
Anonymous
2012-12-02 17:23
>>16
Why do you say I spam /prog/ all day with shit and then ask for help with babby's first exercise?
18
Name:
Anonymous
2012-12-02 17:24
19
Name:
Anonymous
2012-12-02 19:43
20
Name:
Anonymous
2012-12-02 21:40
A lambda is a function without a name, so give it a name and...
21
Name:
Anonymous
2012-12-02 22:14