lispkorea: Recent Problemshttp://lispkorea.org/problemsRecent problems at lispkorea.orghttp://lispkorea.com/problem/87Create an EquationWrite a function which takes three or more integers. Using these integers, your function should generate clojure code representing an equation. The following rules for the equation must be satisfied: 1. All integers must be used once and only once. 2. The order of the integers must be maintained when reading the equation left-to-right. 3. The only functions you may use are +, *, or =. 4. The equation must use the minimum number of parentheses. 5. If no satisfying equation exists, return nil.http://lispkorea.com/problem/86Happy numbersHappy numbers are positive integers that follow a particular formula: take each individual digit, square it, and then sum the squares to get a new number. Repeat with the new number and eventually, you might get to a number whose squared sum is 1. This is a happy number. An unhappy number (or sad number) is one that loops endlessly. Write a function that determines if a number is happy or not.http://lispkorea.com/problem/85Power SetWrite a function which generates the <a href="http://en.wikipedia.org/wiki/Power_set">power set</a> of a given set. The power set of a set x is the set of all subsets of x, including the empty set and x itself.http://lispkorea.com/problem/84Transitive ClosureWrite a function which generates the <a href="http://en.wikipedia.org/wiki/Transitive_closure">transitive closure</a> of a <a href="http://en.wikipedia.org/wiki/Binary_relation">binary relation</a>. The relation will be represented as a set of 2 item vectors.http://lispkorea.com/problem/83A Half-TruthWrite a function which takes a variable number of booleans. Your function should return true if some of the parameters are true, but not all of the parameters are true. Otherwise your function should return false.http://lispkorea.com/problem/82Word ChainsA word chain consists of a set of words ordered so that each word differs by only one letter from the words directly before and after it. The one letter difference can be either an insertion, a deletion, or a substitution. Here is an example word chain:<br/><br/>cat -> cot -> coat -> oat -> hat -> hot -> hog -> dog<br/><br/>Write a function which takes a sequence of words, and returns true if they can be arranged into one continous word chain, and false if they cannot.http://lispkorea.com/problem/81Set IntersectionWrite a function which returns the intersection of two sets. The intersection is the sub-set of items that each set has in common.http://lispkorea.com/problem/80Perfect NumbersA number is "perfect" if the sum of its divisors equal the number itself. 6 is a perfect number because 1+2+3=6. Write a function which returns true for perfect numbers and false otherwise.http://lispkorea.com/problem/79Triangle Minimal PathWrite a function which calculates the sum of the minimal path through a triangle. The triangle is represented as a vector of vectors. The path should start at the top of the triangle and move to an adjacent number on the next row until the bottom of the triangle is reached.http://lispkorea.com/problem/78Reimplement TrampolineReimplement the function described in <a href="76"> "Intro to Trampoline"</a>.http://lispkorea.com/problem/77Anagram FinderWrite a function which finds all the anagrams in a vector of words. A word x is an anagram of word y if all the letters in x can be rearranged in a different order to form y. Your function should return a set of sets, where each sub-set is a group of words which are anagrams of each other. Each sub-set should have at least two words. Words without any anagrams should not be included in the result.http://lispkorea.com/problem/76Intro to TrampolineThe trampoline function takes a function f and a variable number of parameters. Trampoline calls f with any parameters that were supplied. If f returns a function, trampoline calls that function with no arguments. This is repeated, until the return value is not a function, and then trampoline returns that non-function value. This is useful for implementing mutually recursive algorithms in a way that won't consume the stack.http://lispkorea.com/problem/75Euler's Totient FunctionTwo numbers are coprime if their greatest common divisor equals 1. Euler's totient function f(x) is defined as the number of positive integers less than x which are coprime to x. The special case f(1) equals 1. Write a function which calculates Euler's totient function.http://lispkorea.com/problem/74Filter Perfect SquaresGiven a string of comma separated integers, write a function which returns a new comma separated string that only contains the numbers which are perfect squares.http://lispkorea.com/problem/73Analyze a Tic-Tac-Toe BoardA <a href="http://en.wikipedia.org/wiki/Tic-tac-toe">tic-tac-toe</a> board is represented by a two dimensional vector. X is represented by :x, O is represented by :o, and empty is represented by :e. A player wins by placing three Xs or three Os in a horizontal, vertical, or diagonal row. Write a function which analyzes a tic-tac-toe board and returns :x if X has won, :o if O has won, and nil if neither player has won.http://lispkorea.com/problem/72Rearranging Code: ->>The ->> macro threads an expression x through a variable number of forms. First, x is inserted as the last item in the first form, making a list of it if it is not a list already. Then the first form is inserted as the last item in the second form, making a list of that form if necessary. This process continues for all the forms. Using ->> can sometimes make your code more readable.http://lispkorea.com/problem/71Rearranging Code: ->The -> macro threads an expression x through a variable number of forms. First, x is inserted as the second item in the first form, making a list of it if it is not a list already. Then the first form is inserted as the second item in the second form, making a list of that form if necessary. This process continues for all the forms. Using -> can sometimes make your code more readable.http://lispkorea.com/problem/70Word SortingWrite a function which splits a sentence up into a sorted list of words. Capitalization should not affect sort order and punctuation should be ignored.http://lispkorea.com/problem/69Merge with a FunctionWrite a function which takes a function f and a variable number of maps. Your function should return a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) should be combined with the mapping in the result by calling (f val-in-result val-in-latter)http://lispkorea.com/problem/68Recurring ThemeClojure only has one non-stack-consuming looping construct: recur. Either a function or a loop can be used as the recursion point. Either way, recur rebinds the bindings of the recursion point to the values it is passed. Recur must be called from the tail-position, and calling it elsewhere will result in an error.