Skip to content

Max or Min decided by previous column #129

Answered by EvgSkv
jedi1992 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello,
it should work as follows:

MyFinal(my_val: , my_list:, cmd:) :-  
  min_val Min= (l:- l in my_list),
  max_val Max= (l :- l in my_list),
  my_val == (if cmd == "Min" then min_val else max_val);

And you can create a function to run over list to make it a little more readable:

Element(l) = x :- x in l;
MyFinal(my_val: , my_list:, cmd:) :-  
  min_val Min= Element(l),
  max_val Max= Element(l),
  my_val == (if cmd == "Min" then min_val else max_val);

Let me know if this helps.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jedi1992
Comment options

@EvgSkv
Comment options

Answer selected by jedi1992
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants