title: How to look up a value inside a list in a predicate, in PROLOG
body: <p>So far I've done my fair amount of research and I've tried different methods, however even after reading multiple stack overflow answers and even a PDF from Addison Wesley, I can't find the way to do it. Here is the code</p>
  
  <pre><code>use_module(library(func)).
  % importing library "func"
  
  scale([c, d, e, f, g, a, b]).
  scale(c, major, [c, d, e, f, g, a, b]).
  scale(c, minor, [c, d, e_b, f, g, a_b, b_b]).
  
  %1st attempt 
  search(note, scale):- scale(note, scale).
  
  %2nd attempt
  scaleOf(note, type_scale):- scale(note, type_scale).
  
  on(item,[item|rest]).  
  
  on(item,[disregardHead|tail]):-
      scale(tail),
      on(item, tail).
  
  %3rd attempt 
  
  fatherOf(father,type, son):- scale(father, type, sons), search(son, type, sons).
  search(son, type, []):- !, fail.
  search(son, type, [son|l]):- !, true.
  search(son, type, [c|l]):- search(son, type, l).
  </code></pre>
  
  <p>What am I attempting? Simple, something that can iterate through the predicate scale(c, [c, d, e, f, g, a, b]). But I can't get it right. </p>
  
  <p>Edit: I have multiple predicates because someone else suggested creating a predicate that would differentiate one scale from the other. I thought I could cram it inside any algorithm but I guess PROLOG is not that lenient :p</p>