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

  • Home
  • SEARCH
  • 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 9098627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:24:24+00:00 2026-06-17T00:24:24+00:00

In Rebol 2 there was a HASH! type as well as a MAP! type.

  • 0

In Rebol 2 there was a HASH! type as well as a MAP! type. Both of which were supported by the FIND and SELECT functions, as well as by path-based selection:

>> m: to map! [someKey someValue]
== make hash! [someKey someValue]

>> m/someKey
== someValue

>> select m 'someKey
== someValue

To detect that a key wasn’t in the map, you could use FIND and test against NONE

>> find m 'someOtherKey
== none

But path-based selection would get an error in this case:

>> m/someOtherKey
** Script Error: Invalid path value: someOtherKey
** Near: m/someOtherKey

On the other hand, Rebol 3 only has MAP!. But FIND and SELECT only support series types, and MAP! is not considered to be a series any longer. The only way I see (?) to interact with maps is through path selection, which does not throw an error in the non-membership case:

>> m/someOtherKey
== none

…and if your key is in a variable (or a string) you have to use PAREN!

>> var: 'someKey
== someKey

>> m/(var)
== someValue

That works in Rebol 2 also, but with the same caveat of throwing an error instead of returning NONE when you ask for something that doesn’t exist.

So if I’m getting this right, path selection is the “common” way of retrieving values from keys in Rebol 2 and 3. Despite that, I’m not seeing a common way of testing for lack of membership. How does one handle this?

  • 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-17T00:24:25+00:00Added an answer on June 17, 2026 at 12:24 am

    Three things to note:

    1. Most immediately pertaining to your question: select works fine in Rebol 3 as well, as the following interaction shows:

      >> system/version
      == 2.100.111.4.4  ; That's Rebol 3 A111.
      
      >> m: map [a 1 b 2 c 3]
      == make map! [
          a 1
          b 2
          c 3
      ]
      
      >> select m 'b
      == 2
      
      >> select m 'd
      == none
      

      By looking at the spec of select in R3 (using e.g. ? series), we also quickly find out that it accepts values of the following types as first argument: series!, port!, map! (!), object!, none!.

    2. R2 does not really have a map! type. It is faked using hash! as part of the “R2/Forward” forward-compatibility layer for R2. (Look at what result you get from to map! [a 1 a 2] in R2 and R3 to see how this may hit you.)

    3. Note that with select you can not really distinguish between keys without any associated value or keys associated with #[none] as value. If you really need that distinction, it’s easy to do in R3, where you can use words-of to retrieve the keys of a map!:

      >> words-of map [a 1 b 2]
      == [a b]
      

      However, that was not yet back-ported to R2.

      One more portable way which, however, may be considered relying on implementation internals, is to convert map! (R3) or hash! (R2) back to a block!, and using extract to obtain only the keys:

       >> m: to map! [a 1 b 2]
       >> extract to block! m 2
       == [a b]
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Rebol (600 Ko only) is based on antigrain geometry library which is Opensource http://www.antigrain.com/
Can somebody please tell me which version of Rebol 2 to use on CentOS?
Let's say I type a stupid command in Rebol Console like >> AWordThatMeansNothing **
I'm trying to make a map of operators to their opposites in Rebol 2,
In this code web-dir: %./www/ ; the path to rebol www subdirectory listen-port: open/lines
Are there any real-world prototype-based programming languages with a whole development cycle? A whole
There are a bunch of samples in other programming languages but none for rebol.
Using Rebol/View 2.7.7, I'm trying to create a card game based on Nick's Rebol
In Rebol 2, it is possible to get the full path of a file
Rebol tells the error and the line but it doesn't say in what source

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.