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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:27:09+00:00 2026-05-31T18:27:09+00:00

I am new to clojure and am trying to simply generate a list with

  • 0

I am new to clojure and am trying to simply generate a list with the Fibonacci Sequence (in reverse order). I try and run the program via the command line (thus the println to display the result):

(defn fib [n]
    (cond
     (== 1 n) '(1)
     (== 2 n) '(2 1)
     :else (fibAcc n '(2 1))))

(defn fibAcc [n lst]
    (if (zero? n)
        lst
        (fibAcc (dec n) (cons (+ (first lst) (second lst)) lst))))

(println (fib 8))

I get the following error:

Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: fibAcc in this context, compiling:
C:\Users\...\ProjectEuler\2.clj:5)
        at clojure.lang.Compiler.analyze(Compiler.java:6235)
        at clojure.lang.Compiler.analyze(Compiler.java:6177)
        at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3452)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6411)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.analyze(Compiler.java:6177)
        at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2597)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6409)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6397)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.analyze(Compiler.java:6177)
        at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2605)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6409)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6397)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.analyze(Compiler.java:6177)
        at clojure.lang.Compiler$IfExpr$Parser.parse(Compiler.java:2605)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6409)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6397)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.analyze(Compiler.java:6177)
        at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5572)
        at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5008)
        at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3629)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6407)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6397)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.access$100(Compiler.java:37)
        at clojure.lang.Compiler$DefExpr$Parser.parse(Compiler.java:492)
        at clojure.lang.Compiler.analyzeSeq(Compiler.java:6409)
        at clojure.lang.Compiler.analyze(Compiler.java:6216)
        at clojure.lang.Compiler.analyze(Compiler.java:6177)
        at clojure.lang.Compiler.eval(Compiler.java:6469)
        at clojure.lang.Compiler.load(Compiler.java:6902)
        at clojure.lang.Compiler.loadFile(Compiler.java:6863)
        at clojure.main$load_script.invoke(main.clj:282)
        at clojure.main$script_opt.invoke(main.clj:342)
        at clojure.main$main.doInvoke(main.clj:426)
        at clojure.lang.RestFn.invoke(RestFn.java:436)
        at clojure.lang.Var.invoke(Var.java:409)
        at clojure.lang.AFn.applyToHelper(AFn.java:167)
        at clojure.lang.Var.applyTo(Var.java:518)
        at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unable to resolve symbol: fibAcc in this context
        at clojure.lang.Util.runtimeException(Util.java:156)
        at clojure.lang.Compiler.resolveIn(Compiler.java:6720)
        at clojure.lang.Compiler.resolve(Compiler.java:6664)
        at clojure.lang.Compiler.analyzeSymbol(Compiler.java:6625)
        at clojure.lang.Compiler.analyze(Compiler.java:6198)
        ... 46 more
  • 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-31T18:27:11+00:00Added an answer on May 31, 2026 at 6:27 pm

    Define fibAcc before fib, or add (declare fibAcc) before the definition of fib.

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

Sidebar

Related Questions

I'm trying to create a new type in Clojure using deftype to implement a
I'm relatively new to Clojure and a complete HTML/Compojure virgin. I'm trying to use
I am new to Clojure, and am beginning to experiment with building an application.
Simple question. I'm new to Clojure. How can I use one file from my
Clojure structs can be arbitrarily extended, adding new fields. Is it possible to extend
I have a question about Clojure: I am trying to learn the language by
I've been trying out fnparse library written by Joshua Choi in Clojure and I'm
I am trying to build a list of dynamic types that is actually of
inspired by Clojure, and Peter Norvig I have been trying my hand at implementing
I'm very new to WPF and the EF, and I'm trying to display some

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.