Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with 4Clojure, Easy Section, 4/21 #12

Open
fer-git opened this issue Oct 17, 2017 · 2 comments
Open

Problem with 4Clojure, Easy Section, 4/21 #12

fer-git opened this issue Oct 17, 2017 · 2 comments

Comments

@fer-git
Copy link

fer-git commented Oct 17, 2017

I am trying to solve "Nth Element" Problem on question 4/21 in Easy section. I did not use "nth" function but I got error "You can not use blacklisted functions, symbols, namespaces etc. You tripped the alarm! nth is bad!". Here I attach the screenshot.
4clojure_nth_problem

@ertugrulcetin
Copy link
Member

I can reproduce it and it is very odd. When you use destructuring it fails which it should not. So I'm going to look into that, thanks! Here is a working solution:

(defn my-nth 
  [lst n]
  (let [head (first lst)
        tail (rest lst)]
    (if (not= 0 n)
      (my-nth tail (dec n))
      head)))

@andrewroldugin
Copy link

Still doesn't work if using destructuring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants