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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:55:44+00:00 2026-06-17T07:55:44+00:00

I keep on having this error but i cannot seem to resolve it. (ns

  • 0

I keep on having this error but i cannot seem to resolve it.

(ns stack)


(def output [[1, 2 ,3]])
(def condensedrecords 0)
(def i 0)
(def currentDateTime 0)
(def timeDiffinSeconds 0)
(def secondLastOutputValue 0)
(def outlier [])
(def isOutlier false)
(def timeDiffinSeconds 20)
(def for1 true)
(def ab [1])

;just for testing 
(def a [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30])
(def b [a, a])


(def NoOfLines 3)
(defn getOutlierConfidence [p i]
  0.5)

 (defn processNewTransaction [p i] 1)
(defn exceedTimeThresholdwDistance [p i] false)

(defn doRunThroughSplit [vector]
(loop [i 1
       condensed 0
       output1 output
       outlier1 outlier] 

  (if (< i (- NoOfLines 1))  
    (let [p ((peek output1) 1)] ;function doesnt work 
      (cond 
        ;cond1
        (= ((vector i) 27) ((peek output1) 1)) (do(let [condensed (inc condensed)]
                                                      (println "in cond1")
                                                      (recur (inc i) condensed output1 outlier1)))
        ;cond2
        (> timeDiffinSeconds 480) (do (let [i (processNewTransaction p i)] (println "in cond2") (recur (inc i) condensed output1 outlier1)))

        ;cond3
        (> timeDiffinSeconds 600) (do (let [i (processNewTransaction p i)] (println "in cond3") (recur (inc i) condensed output1 outlier1)))

        ;cond4
        (exceedTimeThresholdwDistance p i) (do (let [i (processNewTransaction p i)] (println "in cond4") (recur (inc i) condensed output1 outlier1)))

        (and (not= ((peek output) 1) ((vector i) 27)) (not= secondLastOutputValue ((vector i) 27))) 
                       (do ;perform the following statements

                           (println "in cond5")
                           (let [secondLastOutputValue ((peek vector) 27)]                                                               
                            ***output1 (conj ([output1] ab))]*** ;error starts at here/// ab is a vector by commenting this line the error is removed
                             (println "reached")
                                 (recur (inc i) condensed output1 outlier1)))


        );cond ending 
    );let ending
[condensed, output1, outlier1]);if ending
);loop ending
);func ending

(def sa (doRunThroughSplit b))

The error has been commented out which is the line
output1 (conj ([output1] ab))
But i cannot seem to resolve this error at all. The majority of the code seems fine but once it hits the let statement in cond5 it gives an error.

The output would be

in cond5
///it ends here

  • 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-17T07:55:45+00:00Added an answer on June 17, 2026 at 7:55 am

    It seems that you’re translating some code from some imperative language (Java?), because there are some things which are completely redundant in clojure.

    First of all, most of the first definitions (a number of defs in the beginning) are not required at all. You do not have to define your variables in this way in clojure: all variables are introduced automatically into the lexical scope with corresponding constructions (let, loop, defn for local parameters etc.), and def is supposed to create something like global variables.

    Next, what do you intend for these constructions to do: ((peek output1) 1), ((vector i) 27)? They are completely meaningless. If you want to get an element from a collection by index, you have to do something like (get collection 123) or even (collection 123) provided that collection is some collection, e.g. vector.

    Finally, your question. (conj) function is really not supposed to be called like that. A piece from documentation:

    Usage: (conj coll x)
           (conj coll x & xs)
    
    conj[oin]. Returns a new collection with the xs
    'added'. (conj nil item) returns (item).  The 'addition' may
    happen at different 'places' depending on the concrete type.
    

    See, it should be called with a collection as the first argument and elements you wish to insert into this collection as all other arguments. So, if you want to add ab to output1 collection, you should do (conj output1 ab).

    Note, however, that fixing conj will not make your code work. There are more mistakes in the code (e.g. the ones I mentioned in second point of my answer) which need to be fixed.

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

Sidebar

Related Questions

I'm having this problem where I keep getting this error in my console: *
I keep getting this error with HG (Mercurial), it seems like it's having a
I keep getting an error: invaled syntax for 1.add_xpath('tagLine', '//p[@class=tagline]/text()') and I cannot seem
I keep having an error when running my web application. The error does not
I'm writing a C program but I keep having problems with my array of
I keep getting a Run Time error that says I am having an Exception
I'm having trouble getting my validation to act correctly. I keep getting the error
This VLM Config works in VLC 1.1, but I am having other issues with
So for some time now I keep having this problem: on windows 7 (64bit),
So I keep getting this error when trying to compile C++ code using CodeBlocks.

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.