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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:35:26+00:00 2026-05-23T16:35:26+00:00

example: type person = { name : string ; age : int } db

  • 0

example:

type person = { name : string
                ; age : int
              }

db /person : intmap(person)

I know how to get a single person from the db, but how do I get them all? and print them in a html table?

Thx.

  • 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-05-23T16:35:27+00:00Added an answer on May 23, 2026 at 4:35 pm

    I advise you to use Db.intmap_fold_range instead of InMap.fold.
    It will be faster than InMap.fold which need to build the all map in OPA before folding on it.

    http://opalang.org/resources/doc/index.html#db.opa.html/!/value_stdlib.core.db.Db.intmap_fold_range

    Here is an example for your type:

    type person = { name : string
                    ; age : int
                  }
    
    db /person : intmap(person)
    
    add(name, age) =
      /person[age] <- { ~name; ~age }
    
    fold_person(acc, id) =
     person = /person[id]
     <>{acc}</><li>{person.name} {person.age}</li>
    
    start() =
      do add("name1", 1)
      do add("name2", 2)
      do add("name3", 3)
      Db.intmap_fold_range(
        @/person,
        fold_person,
        <></>, 0, none, /* acc, starting key, optional max */
        (_ -> true) /* check range */
      )
    
    server = one_page_server("Hello", start)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The Java data type byte for example holds data from -128 to 127 in
I'm trying to get derived complex types from a base type in an xsd
Roll with me and imagine the following example: Public ViewResult GiveMeFruit(int personId, string personName,
Say I have a compound JSON object like so: { Person: { name:test, age:
Getting started with jquery and having trouble getting hello world type example going for
I have C header file containing the following type definition: // example.h typedef struct
Is it possible to use multiple header types in one document? For example: header(Content-type:
For example, given a type param method i'm looking for something like the part
For example, if you type something in upper-right google/yahoo search box in firefox there
I have a custom c# type like (just an example): public class MyVector {

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.