Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8861905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:35:54+00:00 2026-06-14T15:35:54+00:00

def isLegalFor(board:Board) = (board(from), board(to)) match { case (Nil, _) => false case (x

  • 0
    def isLegalFor(board:Board) = 
        (board(from), board(to)) match {
            case (Nil, _) => false
            case (x :: _, Nil) => true
            case (x :: _, y :: _) if x < y => true
            case (x :: _, y :: _) if x > y => false             
        }

board(from) and board(to) are both List[Int]

produces warning:

[warn] missing combination              *           Nil             *             *

This seems really confusing.
The first case should cover list1 being empty and list2 being anything at all
The last three cases should cover list1 having at least one element and list2 being either empty or at least one element.

List can be either empty or not … thats four total combinations. Seems ok. What is missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:35:55+00:00Added an answer on June 14, 2026 at 3:35 pm

    You are missing a condition when both lists have at least one element x and y and x == y:

    case (x :: _, y :: _) if x == y => ???
    

    or if you decide what to do with x == y you can combine the last two cases and include the third one above with simple:

    case (x :: _, y :: _) => x < y
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

def make_str_from_row(board, row_index): ''' (list of list of str, int) -> str Return the
def activate(): if(ultrasonic.get_sample() < 10): both.turn(power=-70, tacho_units=400, brake=False) time.sleep(1) bx,by = get_ballxy() rx,ry,a =
def common_elements(list1, list2): Return a list containing the elements which are in both list1
def makecounter(): return collections.defaultdict(int) class RankedIndex(object): def __init__(self): self._inverted_index = collections.defaultdict(list) self._documents = []
def download_if_dne(href, filename): if os.path.isfile(filename): # print 'already downloaded:', href return False else: if
def update @album = Album.find(params[:id]) if @album.update_attributes(params[:album]) redirect_to(:action=>'list') else render(:action=>'edit') end end A Rails
def partial(template, *args) options = args.extract_options! options.merge!(:layout => false) if collection = options.delete(:collection) then
def winner(p1, p2) wins = {rock: :scissors, scissors: :paper, paper: :rock} {true => p1,
def register(request): flag = True possible = '0123456789abcdefghijklmnopqrstuvwxyz' token = '' length = 10
def remove_section(alist, start, end): Return a copy of alist removing the section from start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.