functional programming - Search in a list with argument -


I am trying to implement a function that has given an argument and a list, before adding that argument Find the element in a list

like this:

  #lang scheme (define pairs (opposition 1 2) (opposition 2 3) (opposition 2 4) (opposition) 3 1)) (Opposition 2 5) (Opposition 4 4))); It only tries to get the first element, I need to run every pair on the pair (lambda (lst arg) (if (equal? ​​(Car (first list) 2); The effort given below is for each element Enqueue, because it does not separate pairs (defined (RG) (lambda (x) 2)) (map (lambda (e) ( 

this idea is simple, I have There are elements of the pair and a given number I need to see that the couple's first taut And (they are in the list) starts with that number

thanks in advance

In the racket, implementing in the context of map is easy. Just do this:

  (search-pair lst arg) (map (lambda (e) (if Alternatively, you can do this with "hand", basically the  ("abre?" (Car e) arg) "ok" "nok"))  

You can modify the map again. Note that in the plan we can looping Using clear replay to implement are:

  (define a pair lst arg) (cond ((null? By the way, it works as expected:   

P>

  (find pairs added 2) => ("nose" "ok" "ok" "no" "ok" "") (search pair pair 7) = & Gt; '("nozzle" "nozzle" "nozzle" "nozzle" "nozzle" "nozzle")  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -