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 8102163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:10:32+00:00 2026-06-05T23:10:32+00:00

I am trying to implement does_key_exist, I thought the code below would do it.

  • 0

I am trying to implement does_key_exist, I thought the code below would do it. But I get a compilation error key not found line: Result := not (x.key = key)

does_key_exist(key: attached STRING):BOOLEAN
    do
        Result := not data.item(hash(key)).for_all (agent (x:like pair_at):BOOLEAN
            do
                Result := not equal(x.key, key)
            end)
    end

definitions:

pair_at(key:attached STRING):TUPLE[key:STRING;value: like value_at]
    require
        does_key_exist(key)
    deferred
    ensure
    end

list_at(key:STRING) : LINKED_LIST[like pair_at]
        require
            does_key_exist(key)
        end

data : ARRAY[like list_at]
  • 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-05T23:10:33+00:00Added an answer on June 5, 2026 at 11:10 pm

    Inline agents in Eiffel have access to attributes of the current object, but not to locals or arguments, as they are just syntactic sugar for “normal” agents, that are constructed upon normal features of the class. The latter do not have any access to the locals or arguments of the other features. So the code can be corrected by passing the argument explicitly:

    does_key_exist (key: STRING): BOOLEAN
        do
            Result := not data.item (hash (key)).for_all
                (agent (x: like pair_at; y: STRING): BOOLEAN
                    do
                        Result := not equal(x.key, y)
                    end
                (?, key))
        end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to update a model, but get the error The operation failed: The
Trying to implement 3-layer (not: tier, I just want to separate my project logically,
I'm trying to implement a diffie-hellman-group1-sha1 key exchange for my node.js implemenation of the
I'm trying to implement AES encryption in my application. I have the following code
I'm trying to implement EF with an existing table structure that I'm not allowed
nHibernate is giving the error : Custom type does not implement UserCollectionType: myApp.Domain.OrderLineCollection. BindingList
I am trying to implement a command line emulator in JavaScript. I want the
I'm trying to implement a getter on one of my db classes. But when
I am a learning Java programming and am trying to compile the below code
I'm trying implement A* Start path finding in my games(which are written with JavaScript,

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.