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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:23:10+00:00 2026-05-17T21:23:10+00:00

The aim of the module described below is to implement a module which once

  • 0

The aim of the module described below is to implement a module which once initiated by an integer n does all the operations based on the value of n.

module ReturnSetZero =
functor ( Elt : int ) ->
    struct
        let rec sublist b e l =
               match l with
           [] -> failwith "sublist"
          | h :: t ->
              let tail = if e = 0 then [] else sublist (b - 1) (e - 1) t in
                    if b > 0 then tail else h :: tail
        let rec zerol = 0:: zerol
        let zeron = sublist 0 n zerol
                (*other operations based on n which is selected once when the module is initialized*)
    end;;

Error: Unbound module type int

What is the issue here? Is there an alternate implementation which is more effective/intuitive?

  • 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-17T21:23:11+00:00Added an answer on May 17, 2026 at 9:23 pm

    A functor maps modules to modules. An integer is not a module, so you cannot use it to as a functor parameter.

    You need to define a module type:

    module type WITH_INTEGER = sig
      val integer : int
    end
    
    module PrintInteger = 
      functor (Int:WITH_INTEGER) -> struct
    
      let print_my_integer () = print_int Int.integer
    

    end

    Of course, unless your module needs to expose types that are dependent on the value of the integer (or you have to expose a lot of values dependent on that integer), you’re probably better off with a plain function that takes that integer as an argument:

    let my_function integer = 
      let data = complex_precomputations integer in 
      function arg -> do_something_with arg data
    

    This lets you run the complex pre-computations only once on the integer (when you pass it to the function).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When developing a new web based application which version of html should you aim
Does anyone know of any existing projects that aim to port Android's Java VM
I made a module prototype with the aim of building complex timer schedules in
The aim is to show a form which will update the div on the
To put this in concise language... Aim: To create a class which can load
I want to write a web-based code generator for a Python crawler. Its aim
My aim is to produce an array, which I can use to add section
My Aim: Sending an email (e.g. support request, error report) out of a C#
SVN and CVS are two very different systems that aim to address the same
I'm trying to find any JavaScript frameworks whose sole aim is to standardize the

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.