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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:43:46+00:00 2026-06-10T10:43:46+00:00

so here is the code: (define (time-prime-test n) (newline) (display n) (start-prime-test n (runtime)))

  • 0

so here is the code:

(define (time-prime-test n)
  (newline)
  (display n)
  (start-prime-test n (runtime)))

(define (start-prime-test n start-time)
  (if (prime? n)
      (report-prime (- (runtime) start-time))))

(define (report-prime elapsed-time)
  (display " *** ")
  (display elapsed-time))

(define (search-for-primes n m)
  (if (< n m) 
      ((time-prime-test n)
       (search-for-primes (+ n 1) m))
      (display " calculating stopped. ")))
(search-for-primes 100000 100020)

and i got this error after “calculating stopped.” has been displayed. like below:

100017
100018
100019 * 54 calculating stopped. . . application: not a procedure; expected a procedure that can be applied to arguments
given: #<void>
arguments…:
#<void>

  • 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-10T10:43:48+00:00Added an answer on June 10, 2026 at 10:43 am

    You intend to execute two expressions inside the consequent part of the if, but if only allows one expression in the consequent and one in the alternative.

    Surrounding both expressions between parenthesis (as you did) won’t work: the resulting expression will be evaluated as a function application of the first expression with the second expression as its argument, producing the error "application: not a procedure; expected a procedure that can be applied to arguments ...", because (time-prime-test n) does not evaluate to a procedure, it evaluates to #<void>.

    You can fix the problem by either using a cond:

    (define (search-for-primes n m)
      (cond ((< n m)
             (time-prime-test n)
             (search-for-primes (+ n 1) m))
            (else
             (display " calculating stopped. "))))
    

    Or a begin:

    (define (search-for-primes n m)
      (if (< n m)
          (begin
            (time-prime-test n)
            (search-for-primes (+ n 1) m))
          (display " calculating stopped. ")))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the code: #include <iostream> #include <time.h> using namespace std; #define ARR_LENGTH 1000000
Here is the code I use to define my array, this code is above
Here is my code: #include <stdio.h> #include <string.h> #include <windows.h> #include <tchar.h> #define MAX_KEY_LENGTH
Here is some C++ code I'm playing around with: #include <iostream> #include <vector> #define
Here is the code: //Note: x actually isn't defined, I'm pulling it from an
Here is the code, I defined two class named Father and Son, and create
I have an image in my code, as defined here var imageObj = new
The script is on jsfiddle here : CODE What it does at the moment
Ok the error is showing up somewhere in this here code if($error==false) { $query
Here is code my jqgrid editing through form. $(#DataEnergy).jqGrid('navGrid', '#pagergrid', {}, //options {editdata: {

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.