GithubHelp home page GithubHelp logo

exercism / clojure Goto Github PK

View Code? Open in Web Editor NEW
153.0 153.0 151.0 1.55 MB

Exercism exercises in Clojure.

Home Page: https://exercism.org/tracks/clojure

License: MIT License

Clojure 98.76% Shell 0.76% Mustache 0.48%
community-contributions-paused exercism-track lisp

clojure's Introduction

Exercism Clojure Track

Configlet CI test

Exercism exercises in Clojure

This is the Clojure track, one of the many tracks on Exercism. It holds all the exercises that are currently implemented and available for students to complete. The track consists of various concept exercises which teach the Clojure syllabus, and various practice exercises, which are unlocked by progressing in the syllabus and can be used to practice concepts learned. You can find this in the config.json.

Running the test suite

To test all exercises with sample solutions using babashka:

./test.clj .

{:tested 86, :fails ()}

Contributing Guide

Please see the contributing guide.

clojure's People

Contributors

achengs avatar andreacrotti avatar arnab avatar bobbicodes avatar canweriotnow avatar cayennes avatar chellbell avatar dependabot[bot] avatar dkinzer avatar ee7 avatar erikschierboom avatar exercism-bot avatar geofflane avatar haus avatar kytrinyx avatar leeqleeq avatar leetwinski avatar lmccombes avatar mathias avatar mtkp avatar nwallace avatar petertseng avatar querenker avatar rubysolo avatar sdmoralesma avatar sjwarner avatar tasxatzial avatar themistoklik avatar unrelatedstring avatar yurrriq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clojure's Issues

Add/require stubs for all exercises

Re conversation on #121 - make stubs a standard feature of clojure track projects... this is actually bringing clojure track closer to typical for the other Lisp family tracks, which IIRC provide basic structure templates for solutions.

TODO:

  • Stub all existing exercises
  • Add stub instructions to CONTRIBUTING guide
  • Add test-for-presence-of-stub to test suite.
  • intelligent stub generator script for new exercises in bin/ (maybe?)

Verify that nothing links to help.exercism.io

The old help site was deprecated in December 2015. We now have content that is displayed on the main exercism.io website, under each individual language on http://exercism.io/languages.

The content itself is maintained along with the language track itself, under the docs/ directory.

We decided on this approach since the maintainers of each individual language track are in the best position to review documentation about the language itself or the language track on Exercism.

Please verify that nothing in docs/ refers to the help.exercism.io site. It should instead point to http://exercism.io/languages/:track_id (at the moment the various tabs are not linkable, unfortunately, we may need to reorganize the pages in order to fix that).

Also, some language tracks reference help.exercism.io in the SETUP.md file, which gets included into the README of every single exercise in the track.

We may also have referenced non-track-specific content that lived on help.exercism.io. This content has probably been migrated to the Contributing Guide of the x-common repository. If it has not been migrated, it would be a great help if you opened an issue in x-common so that we can remedy the situation. If possible, please link to the old article in the deprecated help repository.

If nothing in this repository references help.exercism.io, then this can safely be closed.

Not being able to compile/run tests anymore

With the change normalize test changes, where the (load-file) directive has been taken away, I cannot compile/run test anymore.
When using 'lein test' the following issue happens:

Exception in thread "main" java.lang.RuntimeException: No such var: etl/transform, compiling:(etl_test.clj:6:10)

The etl.clj file has been created, the namespace is there as well as the transform function.

I would have expected that the lines that you added to the project.clj file

 :source-paths [""]
 :test-paths [""]

would set up the tests, but is not the case.

Trying to add a require doesn't help either. Only adding back the (load-file) seems to work.

Add helpful information to the SETUP.md

The contents of the SETUP.md file gets included in
the README.md that gets delivered when a user runs the exercism fetch
command from their terminal.

At the very minimum, it should contain a link to the relevant
language-specific documentation on
help.exercism.io.

It would also be useful to explain in a generic way how to run the tests.
Remember that this file will be included with all the problems, so it gets
confusing if we refer to specific problems or files.

Some languages have very particular needs in terms of the solution: nested
directories, specific files, etc. If this is the case here, then it would be
useful to explain what is expected.


Thanks, @tejasbubane for suggesting that we add this documentation everywhere.
See exercism.io#2198.

Make yurrriq a mentor again

Hey @kytrinyx, I noticed I'm no longer a Clojure mentor. Can we fix that? Since I'm basically maintaining this track at the moment, I figure I should probably be a mentor. ๐Ÿ˜„

Bob is inconsistent with other languages

Posted by @meantime in exercism.io:

The instructions for the Bob assignment say:

He answers 'Whoa, chill out!' if you yell at him.
However, some of the language test cases check for "Woah" (note that the 'h' has moved to the end)

The difference exists in Objective-C, PERL5, OCaml, Elixir, and Clojure

gigasecond: use times (not dates) for inputs and outputs

A duration of a gigasecond should be measured in seconds, not
days.

The gigasecond problem has been implemented in a number of languages,
and this issue has been generated for each of these language tracks.
This may already be fixed in this track, if so, please make a note of it
and close the issue.

There has been some discussion about whether or not gigaseconds should
take daylight savings time into account, and the conclusion was "no", since
not all locations observe daylight savings time.

Documentation: Editors

So, I happened to announce the elisp track on the #editors channel on the Clojurians Slack... someone mentioned how neat it would be to manage exercises from within an IDE (he's using Cursive w/ IntelliJ) and I mentioned the exercism.el package I started and stalled on...

Anyhow, it got me thinking it might be extremely helpful to have a help page on editors & configuration, not sure if this should go in the getting-started-with-clojure help section or somewhere else... should we have this? Thoughts?

Switch to real-world project structure

Update:
Since two people who aren't me support this and no one has yet opposed, I've reworded it from a question to a call to action and a to-do list.

In xlfe, we opted to use a "real-world" directory structure for the exercises and I think there are great benefits to users in doing so. Right now, xclojure uses :{source,test}-paths [""] to allow users to ignore convention and get coding right away.

I think that's a bad idea. See the output below for my proposed changes.

N.B. I'm pretty sure some documentation would have to be updated accordingly, too.

bob
โ”œโ”€โ”€ project.clj
โ”œโ”€โ”€ src
โ”‚ย ย  โ””โ”€โ”€ bob.clj
โ””โ”€โ”€ test
    โ””โ”€โ”€ bob_test.clj
diff --git a/bob/project.clj b/bob/project.clj
index 803ad74..a21fc23 100644
--- a/bob/project.clj
+++ b/bob/project.clj
@@ -1,6 +1,4 @@
 (defproject bob "0.1.0-SNAPSHOT"
   :description "bob exercise."
   :url "https://github.com/exercism/xclojure/tree/master/bob"
-  :source-paths [""]
-  :test-paths [""]
   :dependencies [[org.clojure/clojure "1.7.0"]])

scrabble-score: replace 'multibillionaire' with 'oxyphenbutazone'

The word multibillionaire is too long for the scrabble board. Oxyphenbutazone, on the other hand, is legal.

Please verify that there is no test for multibillionaire in the scrabble-score in this track. If the word is included in the test data, then it should be replaced with oxyphenbutazone. Remember to check the case (if the original is uppercase, then the replacement also should be).

If multibillionaire isn't used, then this issue can safely be closed.

See exercism/problem-specifications#86

Delete configlet binaries from history?

I made a really stupid choice a while back to commit the cross-compiled
binaries for configlet (the tool that sanity-checks the config.json
against the implemented problems) into the repository itself.

Those binaries are HUGE, and every time they change the entire 4 or 5 megs get
recommitted. This means that cloning the repository takes a ridiculously long
time.

I've added a script that can be run on travis to grab the latest release from
the configlet repository (bin/fetch-configlet), and travis is set up to run
this now instead of using the committed binary.

I would really like to thoroughly delete the binaries from the entire git
history, but this will break all the existing clones and forks.

The commands I would run are:

# ensure this happens on an up-to-date master
git checkout master && git fetch origin && git reset --hard origin/master

# delete from history
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch bin/configlet-*' --prune-empty

# clean up
rm -rf .git/refs/original/
git reflog expire --all
git gc --aggressive --prune

# push up the new master, force override existing master branch
git push -fu origin master

If we do this everyone who has a fork will need to make sure that their master
is reset to the new upstream master:

git checkout master
git fetch upstream master
git reset --hard upstream/master
git push -fu origin master

We can at-mention (@) all the contributors and everyone who has a fork here in this
issue if we decide to do it.

The important question though, is: Is it worth doing?

Do you have any other suggestions of how to make sure this doesn't confuse people and break their
repository if we do proceed with this change?

Binary search: check for non-sorted input defeats the purpose of binary search

Checking for non-sorted input is an O(n) operation. Performing the actual binary search is O(log(n)). Forcing the inclusion of an O(n) operation in the implementation of an O(log(n)) algorithm is confusing.

If you don't know that your input is sorted, there's no point in doing a binary search (sorting or checking for sorted input takes at least as long as a linear search), so I think this requirement should be removed.

How to set up a local dev environment

See issue exercism/exercism#2092 for an overview of operation welcome contributors.


Provide instructions on how to contribute patches to the exercism test suites
and examples: dependencies, running the tests, what gets tested on Travis-CI,
etc.

The contributing document
in the x-api repository describes how all the language tracks are put
together, as well as details about the common metadata, and high-level
information about contributing to existing problems, or adding new problems.

The README here should be language-specific, and can point to the contributing
guide for more context.

From the OpenHatch guide:

Here are common elements of setting up a development environment youโ€™ll want your guide to address:

Preparing their computer
Make sure theyโ€™re familiar with their operating systemโ€™s tools, such as the terminal/command prompt. You can do this by linking to a tutorial and asking contributors to make sure they understand it. There are usually great tutorials already out there - OpenHatchโ€™s command line tutorial can be found here.
If contributors need to set up a virtual environment, access a virtual machine, or download a specific development kit, give them instructions on how to do so.
List any dependencies needed to run your project, and how to install them. If there are good installation guides for those dependencies, link to them.

Downloading the source
Give detailed instructions on how to download the source of the project, including common missteps or obstacles.

How to view/test changes
Give instructions on how to view and test the changes theyโ€™ve made. This may vary depending on what theyโ€™ve changed, but do your best to cover common changes. This can be as simple as viewing an html document in a browser, but may be more complicated.

Installation will often differ depending on the operating system of the contributor. You will probably need to create separate instructions in various parts of your guide for Windows, Mac and Linux users. If you only want to support development on a single operating system, make sure that is clear to users, ideally in the top-level documentation.

Discuss tooling

Per discussion elsewhere (TODO: add link) we should mention lein-auto somewhere. We also might want to mention/use clj-fmt or some other linter.

Implement bank-account properly

$ cd bank-account
$ ln -s example.clj bank_account.clj # cheap hack
$ lein test
Testing bank-account-test

Ran 4 tests containing 8 assertions.
0 failures, 0 errors.

lein test bank-account

lein test bank-account-test

lein test :only bank-account-test/check-concurrent-access

ERROR in (check-concurrent-access) (ThreadPoolExecutor.java:2047)
Uncaught exception, not in assertion.
expected: nil
  actual: java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@8ad6665 rejected from java.util.concurrent.ThreadPoolExecutor@30af5b6b[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 3]
 at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution (ThreadPoolExecutor.java:2047)
    java.util.concurrent.ThreadPoolExecutor.reject (ThreadPoolExecutor.java:823)
    java.util.concurrent.ThreadPoolExecutor.execute (ThreadPoolExecutor.java:1369)
    java.util.concurrent.AbstractExecutorService.submit (AbstractExecutorService.java:134)
    clojure.core$future_call.invoke (core.clj:6680)
    clojure.core$pmap$fn__6744.invoke (core.clj:6729)
    clojure.core$map$fn__4553.invoke (core.clj:2624)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.RT.seq (RT.java:507)
    clojure.lang.RT.nthFrom (RT.java:924)
    clojure.lang.RT.nth (RT.java:883)
    clojure.core$pmap$step__6749.invoke (core.clj:6730)
    clojure.core$pmap.invoke (core.clj:6735)
    clojure.core$pcalls.doInvoke (core.clj:6749)
    clojure.lang.RestFn.invoke (RestFn.java:436)
    bank_account_test/fn (bank_account_test.clj:51)
    clojure.test$test_var$fn__7670.invoke (test.clj:704)
    clojure.test$test_var.invoke (test.clj:704)
    clojure.test$test_vars$fn__7692$fn__7697.invoke (test.clj:722)
    clojure.test$default_fixture.invoke (test.clj:674)
    clojure.test$test_vars$fn__7692.invoke (test.clj:722)
    clojure.test$default_fixture.invoke (test.clj:674)
    clojure.test$test_vars.invoke (test.clj:718)
    clojure.test$test_all_vars.invoke (test.clj:728)
    clojure.test$test_ns.invoke (test.clj:747)
    clojure.core$map$fn__4553.invoke (core.clj:2624)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.Cons.next (Cons.java:39)
    clojure.lang.RT.boundedLength (RT.java:1735)
    clojure.lang.RestFn.applyTo (RestFn.java:130)
    clojure.core$apply.invoke (core.clj:632)
    clojure.test$run_tests.doInvoke (test.clj:762)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invoke (core.clj:630)
    user$eval85$fn__140$fn__171.invoke (form-init7525173329464848704.clj:1)
    user$eval85$fn__140$fn__141.invoke (form-init7525173329464848704.clj:1)
    user$eval85$fn__140.invoke (form-init7525173329464848704.clj:1)
    user$eval85.invoke (form-init7525173329464848704.clj:1)
    clojure.lang.Compiler.eval (Compiler.java:6782)
    clojure.lang.Compiler.eval (Compiler.java:6772)
    clojure.lang.Compiler.load (Compiler.java:7227)
    clojure.lang.Compiler.loadFile (Compiler.java:7165)
    clojure.main$load_script.invoke (main.clj:275)
    clojure.main$init_opt.invoke (main.clj:280)
    clojure.main$initialize.invoke (main.clj:308)
    clojure.main$null_opt.invoke (main.clj:343)
    clojure.main$main.doInvoke (main.clj:421)
    clojure.lang.RestFn.invoke (RestFn.java:421)
    clojure.lang.Var.invoke (Var.java:383)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.main.main (main.java:37)

Ran 4 tests containing 8 assertions.
0 failures, 1 errors.
Tests failed.

Meetup - 5th Monday

There is an interesting edge case in the meetup problem:
some months have five Mondays.

March of 2015 has five Mondays (the fifth being March 30th), whereas
February of 2015 does not, and so should produce an error.


Thanks, @JKesMc9tqIQe9M for pointing out the edge case.
See exercism.io#2142.

Update Clojure dep to "1.7.0"

Now that 1.7.0 is out of beta/RC status, we should update the project.clj dependencies to 1.7.0, making sure all tests still pass, of course.

Update config.json to match new specification

For the past three years, the ordering of exercises has been done based on gut feelings and wild guesses. As a result, the progression of the exercises has been somewhat haphazard.

In the past few months maintainers of several tracks have invested a great deal of time in analyzing what concepts various exercises require, and then reordering the tracks as a result of that analysis.

It would be useful to bake this data into the track configuration so that we can adjust it over time as we learn more about each exercise.

To this end, we've decided to add a new key exercises in the config.json file, and deprecate the problems key.

See exercism/discussions#60 for details about this decision.

Note that we will not be removing the problems key at this time, as this would break the website and a number of tools.

The process for deprecating the old problems array will be:

  • Update all of the track configs to contain the new exercises key, with whatever data we have.
  • Simultaneously change the website and tools to support both formats.
  • Once all of the tracks have added the exercises key, remove support for the old key in the site and tools.
  • Remove the old key from all of the track configs.

In the new format, each exercise is a JSON object with three properties:

  • slug: the identifier of the exercise
  • difficulty: a number from 1 to 10 where 1 is the easiest and 10 is the most difficult
  • topics: an array of strings describing topics relevant to the exercise. We maintain
    a list of common topics at https://github.com/exercism/x-common/blob/master/TOPICS.txt. Do not feel like you need to restrict yourself to this list;
    it's only there so that we don't end up with 20 variations on the same topic. Each
    language is different, and there will likely be topics specific to each language that will
    not make it onto the list.

The difficulty rating can be a very rough estimate.

The topics array can be empty if this analysis has not yet been done.

Example:

"exercises": [
  {
    "slug": "hello-world" ,
    "difficulty": 1,
    "topics": [
        "control-flow (if-statements)",
        "optional values",
        "text formatting"
    ]
  },
  {
    "difficulty": 3,
    "slug": "anagram",
    "topics": [
        "strings",
        "filtering"
    ]
  },
  {
    "difficulty": 10,
    "slug": "forth",
    "topics": [
        "parsing",
        "transforming",
        "stacks"
    ]
  }
]

It may be worth making the change in several passes:

  • Add the exercises key with the array of objects, where difficulty is 1 and topics is empty.
  • Update the difficulty settings to reflect a more accurate guess.
  • Add topics (perhaps one-by-one, in separate pull requests, in order to have useful discussions about each exercise).

Unclear README.md for POV exercise

I hope this is the right place to post; if not, please forgive me and point me in the right direction.

The documentation for the POV exercise states that you can start off with a graph,

          0
          |
    1-----2-----3
    |     |     |
  4-+-5 6-+-7 8-+-9

and re-arrange it from 6's perspective, arriving at,

        6
        |
  7-----+-----2
              |
        1-----0-----3
        |           |
      4-+-5       8-+-9

The claim is that it's easy to see the path from 6 to 9, which is 6 2 0 3 9. However, in the initial graph, you don't have to go through the 0 node at all: you could go via 6 2 3 9.

Is the documentation wrong in how the graph is rearranged? Or am I missing some part or intent of the exercise?

Place to discuss exercise improvements

Where is the place to discuss exercise improvements?

E.g., I'm rather dissatisfied with the tests for robot-name, as they don't check for the more intricate stuff like exhausting the space of available names or concurrent access to the module, or what 'random name' should actually mean.

Some of this might be Clojure-centric, some pertaining to the exercise in any language.

Project structure for newcomers

I am pretty new the clojure and just submitted the hello-world. The running the tests section on language page does not mention where to put my solution file, so initially I assumed it would be the problem directory itself. This gave me the error:

Could not locate hello_world__init.class or hello_world.clj on classpath

So I finally put it inside test/ assuming it is the tests that require the file and tests ran successfully. Later found out that exercism-clojure uses to the "real-world project structure" here #84.

I think the directory structure should be mentioned in running the tests section. Also if possible, creating an empty file inside src directory would help, so that people know the source code goes there.

"point-mutations" is deprecated in favor of hamming

This happened a while back, and it was for really weird legacy reasons.

I've since fixed the underlying issues that caused the problem, but for consistency
it would be nice to rename point-mutation to hamming, so that all the tracks are using
the same exercise name.

Once the problem has been renamed, I can run a script on the website to point people's
existing point-mutations solutions to the new hamming exercise so that they'll be able
to review solutions to hamming, and people who solve the new hamming exercise can see
all the old ones.

Copy track icon into language track repository

Right now all of the icons used for the language tracks (which can be seen at http://exercism.io/languages) are stored in the exercism/exercism.io repository in public/img/tracks/. It would make a lot more sense to keep these images along with all of the other language-specific stuff in each individual language track repository.

There's a pull request that is adding support for serving up the track icon from the x-api, which deals with language-specific stuff.

In order to support this change, each track will need to

In other words, at the end of it you should have the following file:

./img/icon.png

See exercism/exercism#2925 for more details.

Fix robot-name test suite false positive when using atoms.

The following code passes current tests for the robot-name exercise on my computer:

(ns robot-name)

(defn robot []
  (atom {:name "KIN123"}))

(defn robot-name [robot]
  (@robot :name))

(defn reset-name [robot]
  (swap! robot (fn [m] (assoc m :name "KIN125"))))

Add LEARNING.md

A short description about Clojure, as well as information about resources for learning the language, are missing from the Clojure track of the website. This can be fixed by adding an ABOUT.md, LEARNING.md, and RESOURCES.md to docs/ with relevant information.

binary: improve tests for invalid numbers

We should have separate tests for:

  • alphabetic characters at the beginning of a valid binary number
  • alphabetic characters at the end of a valid binary number
  • alphabetic characters in the middle of an otherwise valid binary number
  • invalid digits (e.g. 2)

If the test suite for binary has test cases that cover these edge cases, this issue can safely be closed.

See exercism/problem-specifications#95

Skip all but the first test

Most of the languages I work with on exercism have all but the first test skipped. Makes it easy to work through the exercises unskipping tests one by one making them pass.
When I run lein test before writing any code, all tests fail with a bunch of errors.

Was it intentional to keep all tests open here in xclojure?

Set up Travis tests

Why do the tests use load-file?

In my opinion, it's a bad practice and it caused all sorts of headaches when I was setting up track-level testing locally.

Make Hamming conform to official definition

From issue exercism/exercism#1867

Wikipedia says the Hamming distance is not defined for strings of different length.

I am not saying the problems cannot be different, but for such a well-defined concept it would make sense to stick to one definition, especially when the READMEs provide so little information about what is expected from the implementation.

Let's clean this up so that we're using the official definition.

Pass explicit list of multiples in "Sum of Multiples" exercise rather than defaulting to 3 and 5

Hello, as part of exercism/problem-specifications#198 we'd like to make the sum of multiples exercise less confusing. Currently, the README specifies that if no multiples are given it should default to 3 and 5.

We'd like to remove this default, so that a list of multiples will always be specified by the caller. This makes the behavior explicit, avoiding surprising behavior and simplifying the problem.

Please make sure this track's tests for the sum-of-multiples problem do not expect such a default. Any tests that want to test behavior for multiples of [3, 5] should explicitly pass [3, 5] as the list of multiples.

After all tracks have completed this change, then exercism/problem-specifications#209 can be merged to remove the defaults from the README.

The reason we'd like this change to happen before changing the README is that it was very confusing for students to figure out the default behavior. It wasn't clear from simply looking at the tests that the default should be 3 and 5, as seen in exercism/exercism#2654, so some had to resort to looking at the example solutions (which aren't served by exercism fetch, so they have to find it on GitHub). It was added to the README to fix this confusion, but now we'd like to be explicit so we can remove the default line from the README.

You can find the common test data at https://github.com/exercism/x-common/blob/master/sum-of-multiples.json, in case that is helpful.

Nucleotide Count Exception

In the nucleotide exercise the invalid nucleotide test expects an Exception rather than an AssertionError. Is there a reason for this? It felt odd to use interop to solve the test when a {:pre ...} or assert would suffice.

I'd be happy to PR it, I just think it's worth discussing a bit first, given I'm new-ish to Clojure.

Anagram kata example.clj does not pass all the tests in anagram_test.clj

Hi,

The example.clj does not pass all the tests in anagram_test.clj. In particular, the last test that the Uppercase version of a word is not an anagram of the lowercase version.

(deftest capital-word-is-not-own-anagram
(is (= [](anagram/anagrams-for "BANANA" ["banana"]))))

Whilst I would argue that, in the real world BANANA would be an anagram of banana, in the spirit of the programming exercise and the specification given, I would propose a fix such that the code be refactored to add a test that the word is not an uppercase version of itself. Something like the gist linked to here.

https://gist.github.com/DeathRay1977/e312c5c9f51691e3ad88

If this is an agreeable solution, I will submit a pull request and fix it.

triangle: incorrect test in some tracks

Please check if there's a test that states that a triangle with sides 2, 4, 2 is invalid. The triangle inequality states that for any triangle, the sum of the lengths of any two sides must be greater than or equal to the length of the remaining side. If this doesn't affect this track, go ahead and just close the issue.

Move exercises to subdirectory

The problems api (x-api) now supports having exercises collected in a subdirectory
named exercises.

That is to say that instead of having a mix of bin, docs, and individual exercises,
we can have bin, docs, and exercises in the root of the repository, and all
the exercises collected in a subdirectory.

In other words, instead of this:

x{TRACK_ID}/
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ bin
โ”‚ย ย  โ””โ”€โ”€ fetch-configlet
โ”œโ”€โ”€ bowling
โ”‚ย ย  โ”œโ”€โ”€ bowling_test.ext
โ”‚ย ย  โ””โ”€โ”€ example.ext
โ”œโ”€โ”€ clock
โ”‚ย ย  โ”œโ”€โ”€ clock_test.ext
โ”‚ย ย  โ””โ”€โ”€ example.ext
โ”œโ”€โ”€ config.json
โ””โ”€โ”€ docs
โ”‚ย ย  โ”œโ”€โ”€ ABOUT.md
โ”‚ย ย  โ””โ”€โ”€ img
... etc

we can have something like this:

x{TRACK_ID}/
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ bin
โ”‚ย ย  โ””โ”€โ”€ fetch-configlet
โ”œโ”€โ”€ config.json
โ”œโ”€โ”€ docs
โ”‚ย ย  โ”œโ”€โ”€ ABOUT.md
โ”‚ย ย  โ””โ”€โ”€ img
โ”œโ”€โ”€ exercises
โ”‚ย ย  โ”œโ”€โ”€ bowling
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ bowling_test.ext
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ example.ext
โ”‚ย ย  โ””โ”€โ”€ clock
โ”‚ย ย      โ”œโ”€โ”€ clock_test.ext
โ”‚ย ย      โ””โ”€โ”€ example.ext
... etc

This has already been deployed to production, so it's safe to make this change whenever you have time.

Implement Clojure exercises

Copied from exercism/exercism#159


This is a placeholder issue for keeping track of porting assignments to Clojure, or noting why they may not be applicable.

  • bob
  • word-count
  • anagram
  • beer-song
  • nucleotide-count
  • rna-transcription
  • point-mutations
  • phone-number
  • grade-school
  • robot-name
  • leap
  • etl
  • meetup
  • space-age
  • grains
  • gigasecond
  • triangle
  • scrabble-score
  • roman-numerals
  • binary
  • prime-factors
  • raindrops
  • allergies
  • strain
  • atbash-cipher
  • accumulate
  • crypto-square
  • trinary
  • sieve
  • simple-cipher
  • octal
  • luhn
  • pig-latin
  • pythagorean-triplet
  • series
  • difference-of-squares
  • secret-handshake
  • linked-list
  • wordy
  • hexadecimal
  • largest-series-product
  • kindergarden-garden
  • binary-search-tree
  • matrix
  • robot-simulator
  • nth-prime
  • palindrome-products
  • pascals-triangle
  • say
  • sum-of-multiples
  • queen-attack
  • saddle-points
  • ocr-numbers

largest_series_product is weird

The expected values are very strange - 1 when no groups of a sufficient size can be produced, but 0 is a valid value. The strangeness of a sentinel value of 1 means that the obvious solution (below) does not pass the tests:

(defn largest-product [size input]
  (->> (map (zipmap "0123456789" (range)) input)
          (partition size 1)
          (map #(apply * %))
          (reduce max 0)))

Since you have to test if the input to reduce is empty, but cannot seed it with 1. This extra (and pointless) complexity suggests that the task itself could do with improvement.

rna-transcription: don't transcribe both ways

I can't remember the history of this, but we ended up with a weird non-biological thing in the RNA transcription exercise, where some test suites also have tests for transcribing from RNA back to DNA. This makes no sense.

If this track does have tests for the reverse transcription, we should remove them, and also simplify the reference solution to match.

If this track doesn't have any tests for RNA->DNA transcription, then this issue can be closed.

See exercism/problem-specifications#148

Verify "Largest Series Product" exercise implementation

There was some confusion in this exercise due to the ambiguous use of the term consecutive in the README. This could be taken to mean contiguous, as in consecutive by position, or as in consecutive numerically. The the README has been fixed (exercism/problem-specifications#200).

Please verify that the exercise is implemented in this track correctly (that it finds series of contiguous numbers, not series of numbers that follow each other consecutively).

If it helps, the canonical inputs/outputs for the exercise can be found here:
https://github.com/exercism/x-common/blob/master/largest-series-product.json

If everything is fine, go ahead and just close this issue. If there's something to be done, then please describe the steps needed in order to close the issue.

Delete configlet binaries from history?

I made a really stupid choice a while back to commit the cross-compiled
binaries for configlet (the tool that sanity-checks the config.json
against the implemented problems) into the repository itself.

Those binaries are HUGE, and every time they change the entire 4 or 5 megs get
recommitted. This means that cloning the repository takes a ridiculously long
time.

I've added a script that can be run on travis to grab the latest release from
the configlet repository (bin/fetch-configlet), and travis is set up to run
this now instead of using the committed binary.

I would really like to thoroughly delete the binaries from the entire git
history, but this will break all the existing clones and forks.

The commands I would run are:

# ensure this happens on an up-to-date master
git checkout master && git fetch origin && git reset --hard origin/master

# delete from history
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch bin/configlet-*' --prune-empty

# clean up
rm -rf .git/refs/original/
git reflog expire --all
git gc --aggressive --prune

# push up the new master, force override existing master branch
git push -fu origin master

If we do this everyone who has a fork will need to make sure that their master
is reset to the new upstream master:

git checkout master
git fetch upstream master
git reset --hard upstream/master
git push -fu origin master

We can at-mention (@) all the contributors and everyone who has a fork here in this
issue if we decide to do it.

The important question though, is: Is it worth doing?

Do you have any other suggestions of how to make sure this doesn't confuse people and break their
repository if we do proceed with this change?

Grade School sorted-grade-school test.

Currently, this test compares a sorted map against an unsorted hash map, where internal ordering isn't consistent. This needs to be changed.

The subsequent tests checks against a vector, which does maintain its internal order.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.