clojure - Endless loop recur -


I am learning the closet and I have just started and I have participated in a problem that I can not understand. Here is my code:

  (defn biggest_prime_factor [x] (if (prime? X) x) (loop [x divider 2] is running (if (= 0 (mod variable divider) Work (biggest_prom_factor49); work (largest_prom_factor147) (DD / running dividers) (if (prime) D) D (Rick 2D); endless loop!   

I know that this can not be the most effective way of finding the biggest factor, but why am I trying to understand that it gets trapped in a loop? Hey, I'm using the loop-iterative way to iterate, but what am I doing?

< P> Some things
  (defn biggest_prime_factor [x] (if (prime x) x); # 1 (loop [x divider 2] is running (if (= 0 (mod variable divider) ) ()) () (D) () (D) () (D) () () () () (2) Repeat (D2 again)) (X (Ink separator))); 
  1. Additional closing bracket This is a self-generated if without any other Makes no difference to its infinite loop, but will have to give a wrong answer (1) for a key input (unless you start your divider instead of 1, in this case you can leave this initial test ).

  2. This row should be again with x instead of run , otherwise you would have to separate the separator and The Prime Minister has not paid attention to the test will ever be wrong. That's why you wind up in the infinite loop.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -