Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Scheme/DrRacket Help

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

Name: Anonymous 2012-12-02 15:31

You've made like 3 homework threads today.

Name: Anonymous 2012-12-02 15:39

use foldr to represent recursion. now go away

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.

Name: Anonymous 2012-12-02 15:45

(elementary problem!)> ᕦ(ò_óˇ)ᕤ

Name: Anonymous 2012-12-02 15:46

>>5
if its such an elementary problem, then help me? please...

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.

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.

Name: Anonymous 2012-12-02 15:56

I solved it with the use of lambda, but I cannot use lambda yet.

Name: Anonymous 2012-12-02 16:12

Bump

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))

Name: Anonymous 2012-12-02 16:35

>>11
What do you think?

Name: Anonymous 2012-12-02 16:59

>>11
Why are you so fucking stupid?

Name: Anonymous 2012-12-02 17:01

>>13
Why do you think I'm stupid?

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.

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.

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?

Name: Anonymous 2012-12-02 17:24

>>15
How?

Name: Anonymous 2012-12-02 19:43

>>14,17
Hello Eliza.

Name: Anonymous 2012-12-02 21:40

A lambda is a function without a name, so give it a name and...

Name: Anonymous 2012-12-02 22:14

>>20
YOU HELPED HIM!

Don't change these.
Name: Email:
Entire Thread Thread List