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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:36:51+00:00 2026-05-13T14:36:51+00:00

Am new to clojure and learning it by working through SICP. I cannot get

  • 0

Am new to clojure and learning it by working through SICP.

I cannot get this piece of code from SCIP 1.3.1 to work.

What am I missing ?

(defn sum [term a next b] 
  (if (> a b) 
      0
      (+ (term a) (sum term (next a) next b))))

(defn sum-cubes-new [a b]
  ((sum cube a inc b)))

HERE is the error message:

java.lang.Integer cannot be cast to clojure.lang.IFn
  [Thrown class java.lang.ClassCastException]

Restarts:
 0: [ABORT] Return to SLIME's top level.

Backtrace:
  0: user$sum_cubes_new__2868.invoke(summation.clj:33)
  1: user$eval__2874.invoke(NO_SOURCE_FILE:1)
  2: clojure.lang.Compiler.eval(Compiler.java:4642)
  3: clojure.core$eval__5236.invoke(core.clj:2017)
  4: swank.commands.basic$eval_region__910.invoke(basic.clj:40)
  5: swank.commands.basic$eval_region__910.invoke(basic.clj:31)
  6: swank.commands.basic$eval__930$listener_eval__932.invoke(basic.clj:54)
  7: clojure.lang.Var.invoke(Var.java:359)
  8: user$eval__2871.invoke(NO_SOURCE_FILE)
  9: clojure.lang.Compiler.eval(Compiler.java:4642)
 10: clojure.core$eval__5236.invoke(core.clj:2017)
 11: swank.core$eval_in_emacs_package__458.invoke(core.clj:58)
 12: swank.core$eval_for_emacs__536.invoke(core.clj:126)
 13: clojure.lang.Var.invoke(Var.java:367)
 14: clojure.lang.AFn.applyToHelper(AFn.java:179)
 15: clojure.lang.Var.applyTo(Var.java:476)
 16: clojure.core$apply__4370.invoke(core.clj:436)
 17: swank.core$eval_from_control__461.invoke(core.clj:65)
 18: swank.core$eval_loop__464.invoke(core.clj:70)
 19: swank.core$spawn_repl_thread__598$fn__630$fn__632.invoke(core.clj:179)
 20: clojure.lang.AFn.applyToHelper(AFn.java:171)
 21: clojure.lang.AFn.applyTo(AFn.java:164)
 22: clojure.core$apply__4370.invoke(core.clj:436)
 23: swank.core$spawn_repl_thread__598$fn__630.doInvoke(core.clj:176)
 24: clojure.lang.RestFn.invoke(RestFn.java:402)
 25: clojure.lang.AFn.run(AFn.java:37)
 26: java.lang.Thread.run(Thread.java:637)
  • 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-13T14:36:52+00:00Added an answer on May 13, 2026 at 2:36 pm

    (defn sum-cubes-new [a b]
    ( (sum cube a inc b) ) )

    The extra set of parens around the call to sum is causing it to attempt for evaluate the resulting number as a function.

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

Sidebar

Ask A Question

Stats

  • Questions 283k
  • Answers 283k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Consider leveraging the TextBox's Render() method. That'll get you the… May 13, 2026 at 4:20 pm
  • Editorial Team
    Editorial Team added an answer If you only want to read from it, your might… May 13, 2026 at 4:20 pm
  • Editorial Team
    Editorial Team added an answer SELECT CASE WHEN field IS NULL THEN 'Empty' ELSE field… May 13, 2026 at 4:20 pm

Related Questions

I am not to Clojure and attempting to figure out how to do this.
I have a problem with the Enclojure REPL and using clojure modules from it.
I was reading a post by David Walsh on creating a sprite menu with
For some reason no matter what, the pageNumber ends up being the last value
I am trying to disable a number of text boxes intended for displaying data

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.