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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:54:26+00:00 2026-05-18T06:54:26+00:00

hello everyone I have this snippet of the code: local helper(f, i, j) =

  • 0

hello everyone I have this snippet of the code:

local
 helper(f, i, j) = local
                    fun NTimesF(f, n:int) = 
                    if n = 1 then fn (x) => f(x)
                    else fn (x) => f(NTimesF(f, n - 1)(x));
                   in
                    if(i <= j) then NTimesF(f, i) :: helper(f, (i+1), j)
                    else []
                   end
in  
 fun compList f n = helper(f, 1, n);
end;

I need to write program which receives some function f and integer n and produce list of functions such as [f1, f2, … fn] <- fn is the composition of the function n times but every time I receive an error:

- stdIn:1.1-2.9 Error: syntax error: deleting  LOCAL ID LPAREN
stdIn:2.10-2.14 Error: syntax error: deleting  COMMA ID COMMA
stdIn:2.16-2.25 Error: syntax error: deleting  RPAREN EQUALOP LOCAL
stdIn:3.6-3.17 Error: syntax error: deleting  FUN ID
stdIn:4.6-4.10 Error: syntax error: deleting  IF ID
stdIn:4.15-4.22 Error: syntax error: deleting  THEN FN
stdIn:4.27-4.31 Error: syntax error: deleting  DARROW ID
stdIn:5.6-5.13 Error: syntax error: deleting  ELSE FN
stdIn:5.16-5.22 Error: syntax error: deleting  RPAREN DARROW ID
stdIn:6.8-7.8 Error: syntax error: deleting  IN IF
stdIn:7.17-7.29 Error: syntax error: deleting  THEN ID
stdIn:8.6-8.13 Error: syntax error: deleting  ELSE LBRACKET RBRACKET
stdIn:9.8-11.5 Error: syntax error: deleting  END IN FUN

it seems that my nested local declarations are wrong, can somebody please explain why?

  • 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-18T06:54:27+00:00Added an answer on May 18, 2026 at 6:54 am

    There are two ways to define local functions and variables in SML: local ... in ... end and let ... in ... end.

    The difference between local and let is that with local what comes between in and end are one or more variable or function declarations. With let what comes between in and end is an expression.

    Unlike local, let is an expression and the value of a let expression is the value of the expression between in and end.

    Since in your case you have an expression between in and end (and you want the function to evaluate to the result of that expression), you need to use let, not local.

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

Sidebar

Related Questions

hello everyone I have this snippet of the code: local fun NTimesF(f, n:int) =
hello everyone I have this snippet of the code: void* Init(int N) { Hand
hello everyone I have some problem with understanding this piece of the code: import
Hello everyone i currently have this: import feedparser d = feedparser.parse('http://store.steampowered.com/feeds/news.xml') for i in
Hello everyone I have a code and I want to find the number of
Hello everyone, I have been banging my head really hard trying to solve this
Hello everyone Masters Of Web Delevopment :) I have a piece of PHP script
Hello every one I have wrote a simple code in html5 in which I
Hello everyone I am trying to resize an image of 700kb with imagecreatefromjpeg. This
Hello everyone I'm currently having 2 issues with the code below: Upon return of

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.