trackler 2.2.1.0 → 2.2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/list-ops/canonical-data.json +27 -11
- data/problem-specifications/exercises/rotational-cipher/canonical-data.json +8 -8
- data/tracks/clojure/config.json +0 -2
- data/tracks/dart/config.json +0 -2
- data/tracks/elisp/config.json +0 -2
- data/tracks/elixir/config.json +0 -2
- data/tracks/erlang/config.json +190 -83
- data/tracks/go/config.json +0 -2
- data/tracks/groovy/config.json +55 -17
- data/tracks/idris/config.json +0 -2
- data/tracks/java/POLICIES.md +9 -1
- data/tracks/java/exercises/nucleotide-count/src/example/java/{DNA.java → NucleotideCounter.java} +4 -4
- data/tracks/java/exercises/nucleotide-count/src/test/java/{NucleotideTest.java → NucleotideCounterTest.java} +21 -21
- data/tracks/kotlin/exercises/rotational-cipher/README.md +39 -0
- data/tracks/lfe/config.json +0 -2
- data/tracks/lisp/config.json +4 -6
- data/tracks/lisp/config/exercise_readme.go.tmpl +16 -0
- data/tracks/lisp/exercises/allergies/README.md +84 -0
- data/tracks/lisp/exercises/anagram/README.md +60 -0
- data/tracks/lisp/exercises/atbash-cipher/README.md +81 -0
- data/tracks/lisp/exercises/beer-song/README.md +374 -0
- data/tracks/lisp/exercises/binary/README.md +82 -0
- data/tracks/lisp/exercises/bob/README.md +65 -0
- data/tracks/lisp/exercises/crypto-square/README.md +121 -0
- data/tracks/lisp/exercises/difference-of-squares/README.md +66 -0
- data/tracks/lisp/exercises/etl/README.md +98 -0
- data/tracks/lisp/exercises/gigasecond/README.md +58 -0
- data/tracks/lisp/exercises/grade-school/README.md +89 -0
- data/tracks/lisp/exercises/grains/README.md +81 -0
- data/tracks/lisp/exercises/hamming/README.md +89 -0
- data/tracks/lisp/exercises/leap/README.md +80 -0
- data/tracks/lisp/exercises/meetup/README.md +77 -0
- data/tracks/lisp/exercises/nucleotide-count/README.md +80 -0
- data/tracks/lisp/exercises/pascals-triangle/README.md +68 -0
- data/tracks/lisp/exercises/phone-number/README.md +81 -0
- data/tracks/lisp/exercises/prime-factors/README.md +83 -0
- data/tracks/lisp/exercises/raindrops/README.md +71 -0
- data/tracks/lisp/exercises/rna-transcription/README.md +72 -0
- data/tracks/lisp/exercises/robot-name/README.md +69 -0
- data/tracks/lisp/exercises/roman-numerals/README.md +96 -0
- data/tracks/lisp/exercises/scrabble-score/README.md +91 -0
- data/tracks/lisp/exercises/sieve/README.md +81 -0
- data/tracks/lisp/exercises/space-age/README.md +71 -0
- data/tracks/lisp/exercises/strain/README.md +87 -0
- data/tracks/lisp/exercises/triangle/README.md +73 -0
- data/tracks/lisp/exercises/trinary/README.md +75 -0
- data/tracks/lisp/exercises/word-count/README.md +66 -0
- data/tracks/perl5/config.json +0 -2
- data/tracks/perl6/config.json +0 -2
- data/tracks/php/config.json +0 -2
- data/tracks/pony/config.json +33 -0
- data/tracks/python/exercises/scale-generator/scale_generator_test.py +1 -1
- data/tracks/racket/config.json +0 -2
- data/tracks/ruby/config.json +0 -2
- data/tracks/rust/.gitignore +0 -1
- data/tracks/rust/_test/check-exercises.sh +7 -1
- data/tracks/rust/config.json +11 -0
- data/tracks/rust/config/maintainers.json +54 -0
- data/tracks/rust/exercises/acronym/src/lib.rs +0 -0
- data/tracks/rust/exercises/all-your-base/src/lib.rs +35 -0
- data/tracks/rust/exercises/allergies/src/lib.rs +0 -0
- data/tracks/rust/exercises/alphametics/src/lib.rs +5 -0
- data/tracks/rust/exercises/anagram/src/lib.rs +0 -0
- data/tracks/rust/exercises/atbash-cipher/src/lib.rs +0 -0
- data/tracks/rust/exercises/beer-song/src/lib.rs +0 -0
- data/tracks/rust/exercises/bob/src/lib.rs +0 -0
- data/tracks/rust/exercises/bowling/src/lib.rs +0 -0
- data/tracks/rust/exercises/bracket-push/src/lib.rs +0 -0
- data/tracks/rust/exercises/circular-buffer/src/lib.rs +0 -0
- data/tracks/rust/exercises/custom-set/src/lib.rs +0 -0
- data/tracks/rust/exercises/difference-of-squares/src/lib.rs +0 -0
- data/tracks/rust/exercises/dominoes/src/lib.rs +0 -0
- data/tracks/rust/exercises/etl/src/lib.rs +0 -0
- data/tracks/rust/exercises/forth/src/lib.rs +23 -0
- data/tracks/rust/exercises/gigasecond/src/lib.rs +7 -0
- data/tracks/rust/exercises/grade-school/src/lib.rs +26 -0
- data/tracks/rust/exercises/grains/src/lib.rs +7 -0
- data/tracks/rust/exercises/hamming/src/lib.rs +0 -0
- data/tracks/rust/exercises/hello-world/src/lib.rs +5 -0
- data/tracks/rust/exercises/hexadecimal/src/lib.rs +0 -0
- data/tracks/rust/exercises/largest-series-product/src/lib.rs +0 -0
- data/tracks/rust/exercises/leap/src/lib.rs +0 -0
- data/tracks/rust/exercises/luhn-from/src/lib.rs +0 -0
- data/tracks/rust/exercises/luhn-trait/src/lib.rs +0 -0
- data/tracks/rust/exercises/luhn/src/lib.rs +0 -0
- data/tracks/rust/exercises/minesweeper/src/lib.rs +0 -0
- data/tracks/rust/exercises/nucleotide-codons/src/lib.rs +0 -0
- data/tracks/rust/exercises/nucleotide-count/src/lib.rs +0 -0
- data/tracks/rust/exercises/ocr-numbers/src/lib.rs +7 -0
- data/tracks/rust/exercises/pangram/src/lib.rs +0 -0
- data/tracks/rust/exercises/parallel-letter-frequency/src/lib.rs +0 -0
- data/tracks/rust/exercises/pascals-triangle/src/lib.rs +11 -0
- data/tracks/rust/exercises/phone-number/src/lib.rs +0 -0
- data/tracks/rust/exercises/pig-latin/src/lib.rs +0 -0
- data/tracks/rust/exercises/protein-translation/src/lib.rs +0 -0
- data/tracks/rust/exercises/queen-attack/src/lib.rs +0 -0
- data/tracks/rust/exercises/raindrops/src/lib.rs +0 -0
- data/tracks/rust/exercises/react/src/lib.rs +89 -0
- data/tracks/rust/exercises/rectangles/src/lib.rs +0 -0
- data/tracks/rust/exercises/rna-transcription/src/lib.rs +0 -0
- data/tracks/rust/exercises/robot-name/src/lib.rs +0 -0
- data/tracks/rust/exercises/robot-simulator/src/lib.rs +44 -0
- data/tracks/rust/exercises/roman-numerals/src/lib.rs +0 -0
- data/tracks/rust/exercises/rotational-cipher/src/lib.rs +0 -0
- data/tracks/rust/exercises/run-length-encoding/src/lib.rs +0 -0
- data/tracks/rust/exercises/say/.meta/hints.md +19 -0
- data/tracks/rust/exercises/say/Cargo.lock +4 -0
- data/tracks/rust/exercises/say/Cargo.toml +4 -0
- data/tracks/rust/exercises/say/README.md +122 -0
- data/tracks/rust/exercises/say/example.rs +56 -0
- data/tracks/rust/exercises/say/src/lib.rs +4 -0
- data/tracks/rust/exercises/say/tests/say.rs +130 -0
- data/tracks/rust/exercises/scrabble-score/src/lib.rs +0 -0
- data/tracks/rust/exercises/sieve/src/lib.rs +0 -0
- data/tracks/rust/exercises/space-age/src/lib.rs +35 -0
- data/tracks/rust/exercises/sublist/src/lib.rs +0 -0
- data/tracks/rust/exercises/sum-of-multiples/src/lib.rs +0 -0
- data/tracks/rust/exercises/tournament/src/lib.rs +0 -0
- data/tracks/rust/exercises/triangle/src/lib.rs +0 -0
- data/tracks/rust/exercises/variable-length-quantity/src/lib.rs +9 -0
- data/tracks/rust/exercises/word-count/src/lib.rs +0 -0
- data/tracks/rust/exercises/wordy/src/lib.rs +0 -0
- data/tracks/scheme/config.json +0 -2
- metadata +45 -4
@@ -0,0 +1,96 @@
|
|
1
|
+
# Roman Numerals
|
2
|
+
|
3
|
+
Write a function to convert from normal numbers to Roman Numerals.
|
4
|
+
|
5
|
+
The Romans were a clever bunch. They conquered most of Europe and ruled
|
6
|
+
it for hundreds of years. They invented concrete and straight roads and
|
7
|
+
even bikinis. One thing they never discovered though was the number
|
8
|
+
zero. This made writing and dating extensive histories of their exploits
|
9
|
+
slightly more challenging, but the system of numbers they came up with
|
10
|
+
is still in use today. For example the BBC uses Roman numerals to date
|
11
|
+
their programmes.
|
12
|
+
|
13
|
+
The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice
|
14
|
+
these letters have lots of straight lines and are hence easy to hack
|
15
|
+
into stone tablets).
|
16
|
+
|
17
|
+
```
|
18
|
+
1 => I
|
19
|
+
10 => X
|
20
|
+
7 => VII
|
21
|
+
```
|
22
|
+
|
23
|
+
There is no need to be able to convert numbers larger than about 3000.
|
24
|
+
(The Romans themselves didn't tend to go any higher)
|
25
|
+
|
26
|
+
Wikipedia says: Modern Roman numerals ... are written by expressing each
|
27
|
+
digit separately starting with the left most digit and skipping any
|
28
|
+
digit with a value of zero.
|
29
|
+
|
30
|
+
To see this in practice, consider the example of 1990.
|
31
|
+
|
32
|
+
In Roman numerals 1990 is MCMXC:
|
33
|
+
|
34
|
+
1000=M
|
35
|
+
900=CM
|
36
|
+
90=XC
|
37
|
+
|
38
|
+
2008 is written as MMVIII:
|
39
|
+
|
40
|
+
2000=MM
|
41
|
+
8=VIII
|
42
|
+
|
43
|
+
See also: http://www.novaroma.org/via_romana/numbers.html
|
44
|
+
|
45
|
+
## Setup
|
46
|
+
|
47
|
+
Check out [Exercism Help](http://exercism.io/languages/lisp) for instructions to
|
48
|
+
get started writing Common Lisp. That page will explain how to install and setup
|
49
|
+
a Lisp implementation and how to run the tests.
|
50
|
+
|
51
|
+
## Formatting
|
52
|
+
|
53
|
+
While Common Lisp doesn't care about indentation and layout of code,
|
54
|
+
nor whether you use spaces or tabs, this is an important consideration
|
55
|
+
for submissions to exercism.io. Excercism.io's code widget cannot
|
56
|
+
handle mixing of tab and space characters well so using only spaces is recommended to make
|
57
|
+
the code more readable to the human reviewers. Please review your
|
58
|
+
editors settings on how to accomplish this. Below are instructions for
|
59
|
+
popular editors for Common Lisp.
|
60
|
+
|
61
|
+
### VIM
|
62
|
+
|
63
|
+
Use the following commands to ensure VIM uses only spaces for
|
64
|
+
indentation:
|
65
|
+
|
66
|
+
```vimscript
|
67
|
+
:set tabstop=2
|
68
|
+
:set shiftwidth=2
|
69
|
+
:set expandtab
|
70
|
+
```
|
71
|
+
|
72
|
+
(or as a oneliner `:set tabstop=2 shiftwidth=2 expandtab`). This can
|
73
|
+
be added to your `~/.vimrc` file to use it all the time.
|
74
|
+
|
75
|
+
### Emacs
|
76
|
+
|
77
|
+
Emacs is very well suited for editing Common Lisp and has many
|
78
|
+
powerful add-on packages available. The only thing that one needs to
|
79
|
+
do with a stock emacs to make it work well with exercism.io is to
|
80
|
+
evaluate the following code:
|
81
|
+
|
82
|
+
`(setq indent-tab-mode nil)`
|
83
|
+
|
84
|
+
This can be placed in your `~/.emacs` (or `~/.emacs.d/init.el`) in
|
85
|
+
order to have it set whenever Emacs is launched.
|
86
|
+
|
87
|
+
One suggested add-on for Emacs and Common Lisp is
|
88
|
+
[SLIME](https://github.com/slime/slime) which offers tight integration
|
89
|
+
with the REPL; making iterative coding and testing very easy.
|
90
|
+
|
91
|
+
## Source
|
92
|
+
|
93
|
+
The Roman Numeral Kata [http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals](http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals)
|
94
|
+
|
95
|
+
## Submitting Incomplete Solutions
|
96
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# Scrabble Score
|
2
|
+
|
3
|
+
Given a word, compute the scrabble score for that word.
|
4
|
+
|
5
|
+
## Letter Values
|
6
|
+
|
7
|
+
You'll need these:
|
8
|
+
|
9
|
+
```plain
|
10
|
+
Letter Value
|
11
|
+
A, E, I, O, U, L, N, R, S, T 1
|
12
|
+
D, G 2
|
13
|
+
B, C, M, P 3
|
14
|
+
F, H, V, W, Y 4
|
15
|
+
K 5
|
16
|
+
J, X 8
|
17
|
+
Q, Z 10
|
18
|
+
```
|
19
|
+
|
20
|
+
## Examples
|
21
|
+
"cabbage" should be scored as worth 14 points:
|
22
|
+
|
23
|
+
- 3 points for C
|
24
|
+
- 1 point for A, twice
|
25
|
+
- 3 points for B, twice
|
26
|
+
- 2 points for G
|
27
|
+
- 1 point for E
|
28
|
+
|
29
|
+
And to total:
|
30
|
+
|
31
|
+
- `3 + 2*1 + 2*3 + 2 + 1`
|
32
|
+
- = `3 + 2 + 6 + 3`
|
33
|
+
- = `5 + 9`
|
34
|
+
- = 14
|
35
|
+
|
36
|
+
## Extensions
|
37
|
+
- You can play a double or a triple letter.
|
38
|
+
- You can play a double or a triple word.
|
39
|
+
|
40
|
+
## Setup
|
41
|
+
|
42
|
+
Check out [Exercism Help](http://exercism.io/languages/lisp) for instructions to
|
43
|
+
get started writing Common Lisp. That page will explain how to install and setup
|
44
|
+
a Lisp implementation and how to run the tests.
|
45
|
+
|
46
|
+
## Formatting
|
47
|
+
|
48
|
+
While Common Lisp doesn't care about indentation and layout of code,
|
49
|
+
nor whether you use spaces or tabs, this is an important consideration
|
50
|
+
for submissions to exercism.io. Excercism.io's code widget cannot
|
51
|
+
handle mixing of tab and space characters well so using only spaces is recommended to make
|
52
|
+
the code more readable to the human reviewers. Please review your
|
53
|
+
editors settings on how to accomplish this. Below are instructions for
|
54
|
+
popular editors for Common Lisp.
|
55
|
+
|
56
|
+
### VIM
|
57
|
+
|
58
|
+
Use the following commands to ensure VIM uses only spaces for
|
59
|
+
indentation:
|
60
|
+
|
61
|
+
```vimscript
|
62
|
+
:set tabstop=2
|
63
|
+
:set shiftwidth=2
|
64
|
+
:set expandtab
|
65
|
+
```
|
66
|
+
|
67
|
+
(or as a oneliner `:set tabstop=2 shiftwidth=2 expandtab`). This can
|
68
|
+
be added to your `~/.vimrc` file to use it all the time.
|
69
|
+
|
70
|
+
### Emacs
|
71
|
+
|
72
|
+
Emacs is very well suited for editing Common Lisp and has many
|
73
|
+
powerful add-on packages available. The only thing that one needs to
|
74
|
+
do with a stock emacs to make it work well with exercism.io is to
|
75
|
+
evaluate the following code:
|
76
|
+
|
77
|
+
`(setq indent-tab-mode nil)`
|
78
|
+
|
79
|
+
This can be placed in your `~/.emacs` (or `~/.emacs.d/init.el`) in
|
80
|
+
order to have it set whenever Emacs is launched.
|
81
|
+
|
82
|
+
One suggested add-on for Emacs and Common Lisp is
|
83
|
+
[SLIME](https://github.com/slime/slime) which offers tight integration
|
84
|
+
with the REPL; making iterative coding and testing very easy.
|
85
|
+
|
86
|
+
## Source
|
87
|
+
|
88
|
+
Inspired by the Extreme Startup game [https://github.com/rchatley/extreme_startup](https://github.com/rchatley/extreme_startup)
|
89
|
+
|
90
|
+
## Submitting Incomplete Solutions
|
91
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# Sieve
|
2
|
+
|
3
|
+
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given
|
4
|
+
number.
|
5
|
+
|
6
|
+
The Sieve of Eratosthenes is a simple, ancient algorithm for finding all
|
7
|
+
prime numbers up to any given limit. It does so by iteratively marking as
|
8
|
+
composite (i.e. not prime) the multiples of each prime,
|
9
|
+
starting with the multiples of 2.
|
10
|
+
|
11
|
+
Create your range, starting at two and continuing up to and including the given limit. (i.e. [2, limit])
|
12
|
+
|
13
|
+
The algorithm consists of repeating the following over and over:
|
14
|
+
|
15
|
+
- take the next available unmarked number in your list (it is prime)
|
16
|
+
- mark all the multiples of that number (they are not prime)
|
17
|
+
|
18
|
+
Repeat until you have processed each number in your range.
|
19
|
+
|
20
|
+
When the algorithm terminates, all the numbers in the list that have not
|
21
|
+
been marked are prime.
|
22
|
+
|
23
|
+
The wikipedia article has a useful graphic that explains the algorithm:
|
24
|
+
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
|
25
|
+
|
26
|
+
Notice that this is a very specific algorithm, and the tests don't check
|
27
|
+
that you've implemented the algorithm, only that you've come up with the
|
28
|
+
correct list of primes.
|
29
|
+
|
30
|
+
## Setup
|
31
|
+
|
32
|
+
Check out [Exercism Help](http://exercism.io/languages/lisp) for instructions to
|
33
|
+
get started writing Common Lisp. That page will explain how to install and setup
|
34
|
+
a Lisp implementation and how to run the tests.
|
35
|
+
|
36
|
+
## Formatting
|
37
|
+
|
38
|
+
While Common Lisp doesn't care about indentation and layout of code,
|
39
|
+
nor whether you use spaces or tabs, this is an important consideration
|
40
|
+
for submissions to exercism.io. Excercism.io's code widget cannot
|
41
|
+
handle mixing of tab and space characters well so using only spaces is recommended to make
|
42
|
+
the code more readable to the human reviewers. Please review your
|
43
|
+
editors settings on how to accomplish this. Below are instructions for
|
44
|
+
popular editors for Common Lisp.
|
45
|
+
|
46
|
+
### VIM
|
47
|
+
|
48
|
+
Use the following commands to ensure VIM uses only spaces for
|
49
|
+
indentation:
|
50
|
+
|
51
|
+
```vimscript
|
52
|
+
:set tabstop=2
|
53
|
+
:set shiftwidth=2
|
54
|
+
:set expandtab
|
55
|
+
```
|
56
|
+
|
57
|
+
(or as a oneliner `:set tabstop=2 shiftwidth=2 expandtab`). This can
|
58
|
+
be added to your `~/.vimrc` file to use it all the time.
|
59
|
+
|
60
|
+
### Emacs
|
61
|
+
|
62
|
+
Emacs is very well suited for editing Common Lisp and has many
|
63
|
+
powerful add-on packages available. The only thing that one needs to
|
64
|
+
do with a stock emacs to make it work well with exercism.io is to
|
65
|
+
evaluate the following code:
|
66
|
+
|
67
|
+
`(setq indent-tab-mode nil)`
|
68
|
+
|
69
|
+
This can be placed in your `~/.emacs` (or `~/.emacs.d/init.el`) in
|
70
|
+
order to have it set whenever Emacs is launched.
|
71
|
+
|
72
|
+
One suggested add-on for Emacs and Common Lisp is
|
73
|
+
[SLIME](https://github.com/slime/slime) which offers tight integration
|
74
|
+
with the REPL; making iterative coding and testing very easy.
|
75
|
+
|
76
|
+
## Source
|
77
|
+
|
78
|
+
Sieve of Eratosthenes at Wikipedia [http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes](http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes)
|
79
|
+
|
80
|
+
## Submitting Incomplete Solutions
|
81
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# Space Age
|
2
|
+
|
3
|
+
Given an age in seconds, calculate how old someone would be on:
|
4
|
+
|
5
|
+
- Earth: orbital period 365.25 Earth days, or 31557600 seconds
|
6
|
+
- Mercury: orbital period 0.2408467 Earth years
|
7
|
+
- Venus: orbital period 0.61519726 Earth years
|
8
|
+
- Mars: orbital period 1.8808158 Earth years
|
9
|
+
- Jupiter: orbital period 11.862615 Earth years
|
10
|
+
- Saturn: orbital period 29.447498 Earth years
|
11
|
+
- Uranus: orbital period 84.016846 Earth years
|
12
|
+
- Neptune: orbital period 164.79132 Earth years
|
13
|
+
|
14
|
+
So if you were told someone were 1,000,000,000 seconds old, you should
|
15
|
+
be able to say that they're 31 Earth-years old.
|
16
|
+
|
17
|
+
If you're wondering why Pluto didn't make the cut, go watch [this
|
18
|
+
youtube video](http://www.youtube.com/watch?v=Z_2gbGXzFbs).
|
19
|
+
|
20
|
+
## Setup
|
21
|
+
|
22
|
+
Check out [Exercism Help](http://exercism.io/languages/lisp) for instructions to
|
23
|
+
get started writing Common Lisp. That page will explain how to install and setup
|
24
|
+
a Lisp implementation and how to run the tests.
|
25
|
+
|
26
|
+
## Formatting
|
27
|
+
|
28
|
+
While Common Lisp doesn't care about indentation and layout of code,
|
29
|
+
nor whether you use spaces or tabs, this is an important consideration
|
30
|
+
for submissions to exercism.io. Excercism.io's code widget cannot
|
31
|
+
handle mixing of tab and space characters well so using only spaces is recommended to make
|
32
|
+
the code more readable to the human reviewers. Please review your
|
33
|
+
editors settings on how to accomplish this. Below are instructions for
|
34
|
+
popular editors for Common Lisp.
|
35
|
+
|
36
|
+
### VIM
|
37
|
+
|
38
|
+
Use the following commands to ensure VIM uses only spaces for
|
39
|
+
indentation:
|
40
|
+
|
41
|
+
```vimscript
|
42
|
+
:set tabstop=2
|
43
|
+
:set shiftwidth=2
|
44
|
+
:set expandtab
|
45
|
+
```
|
46
|
+
|
47
|
+
(or as a oneliner `:set tabstop=2 shiftwidth=2 expandtab`). This can
|
48
|
+
be added to your `~/.vimrc` file to use it all the time.
|
49
|
+
|
50
|
+
### Emacs
|
51
|
+
|
52
|
+
Emacs is very well suited for editing Common Lisp and has many
|
53
|
+
powerful add-on packages available. The only thing that one needs to
|
54
|
+
do with a stock emacs to make it work well with exercism.io is to
|
55
|
+
evaluate the following code:
|
56
|
+
|
57
|
+
`(setq indent-tab-mode nil)`
|
58
|
+
|
59
|
+
This can be placed in your `~/.emacs` (or `~/.emacs.d/init.el`) in
|
60
|
+
order to have it set whenever Emacs is launched.
|
61
|
+
|
62
|
+
One suggested add-on for Emacs and Common Lisp is
|
63
|
+
[SLIME](https://github.com/slime/slime) which offers tight integration
|
64
|
+
with the REPL; making iterative coding and testing very easy.
|
65
|
+
|
66
|
+
## Source
|
67
|
+
|
68
|
+
Partially inspired by Chapter 1 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=01](http://pine.fm/LearnToProgram/?Chapter=01)
|
69
|
+
|
70
|
+
## Submitting Incomplete Solutions
|
71
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# Strain
|
2
|
+
|
3
|
+
Implement the `keep` and `discard` operation on collections. Given a collection
|
4
|
+
and a predicate on the collection's elements, `keep` returns a new collection
|
5
|
+
containing those elements where the predicate is true, while `discard` returns
|
6
|
+
a new collection containing those elements where the predicate is false.
|
7
|
+
|
8
|
+
For example, given the collection of numbers:
|
9
|
+
|
10
|
+
- 1, 2, 3, 4, 5
|
11
|
+
|
12
|
+
And the predicate:
|
13
|
+
|
14
|
+
- is the number even?
|
15
|
+
|
16
|
+
Then your keep operation should produce:
|
17
|
+
|
18
|
+
- 2, 4
|
19
|
+
|
20
|
+
While your discard operation should produce:
|
21
|
+
|
22
|
+
- 1, 3, 5
|
23
|
+
|
24
|
+
Note that the union of keep and discard is all the elements.
|
25
|
+
|
26
|
+
The functions may be called `keep` and `discard`, or they may need different
|
27
|
+
names in order to not clash with existing functions or concepts in your
|
28
|
+
language.
|
29
|
+
|
30
|
+
## Restrictions
|
31
|
+
|
32
|
+
Keep your hands off that filter/reject/whatchamacallit functionality
|
33
|
+
provided by your standard library! Solve this one yourself using other
|
34
|
+
basic tools instead.
|
35
|
+
|
36
|
+
## Setup
|
37
|
+
|
38
|
+
Check out [Exercism Help](http://exercism.io/languages/lisp) for instructions to
|
39
|
+
get started writing Common Lisp. That page will explain how to install and setup
|
40
|
+
a Lisp implementation and how to run the tests.
|
41
|
+
|
42
|
+
## Formatting
|
43
|
+
|
44
|
+
While Common Lisp doesn't care about indentation and layout of code,
|
45
|
+
nor whether you use spaces or tabs, this is an important consideration
|
46
|
+
for submissions to exercism.io. Excercism.io's code widget cannot
|
47
|
+
handle mixing of tab and space characters well so using only spaces is recommended to make
|
48
|
+
the code more readable to the human reviewers. Please review your
|
49
|
+
editors settings on how to accomplish this. Below are instructions for
|
50
|
+
popular editors for Common Lisp.
|
51
|
+
|
52
|
+
### VIM
|
53
|
+
|
54
|
+
Use the following commands to ensure VIM uses only spaces for
|
55
|
+
indentation:
|
56
|
+
|
57
|
+
```vimscript
|
58
|
+
:set tabstop=2
|
59
|
+
:set shiftwidth=2
|
60
|
+
:set expandtab
|
61
|
+
```
|
62
|
+
|
63
|
+
(or as a oneliner `:set tabstop=2 shiftwidth=2 expandtab`). This can
|
64
|
+
be added to your `~/.vimrc` file to use it all the time.
|
65
|
+
|
66
|
+
### Emacs
|
67
|
+
|
68
|
+
Emacs is very well suited for editing Common Lisp and has many
|
69
|
+
powerful add-on packages available. The only thing that one needs to
|
70
|
+
do with a stock emacs to make it work well with exercism.io is to
|
71
|
+
evaluate the following code:
|
72
|
+
|
73
|
+
`(setq indent-tab-mode nil)`
|
74
|
+
|
75
|
+
This can be placed in your `~/.emacs` (or `~/.emacs.d/init.el`) in
|
76
|
+
order to have it set whenever Emacs is launched.
|
77
|
+
|
78
|
+
One suggested add-on for Emacs and Common Lisp is
|
79
|
+
[SLIME](https://github.com/slime/slime) which offers tight integration
|
80
|
+
with the REPL; making iterative coding and testing very easy.
|
81
|
+
|
82
|
+
## Source
|
83
|
+
|
84
|
+
Conversation with James Edward Gray II [https://twitter.com/jeg2](https://twitter.com/jeg2)
|
85
|
+
|
86
|
+
## Submitting Incomplete Solutions
|
87
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Triangle
|
2
|
+
|
3
|
+
Determine if a triangle is equilateral, isosceles, or scalene.
|
4
|
+
|
5
|
+
An _equilateral_ triangle has all three sides the same length.<br/>
|
6
|
+
An _isosceles_ triangle has at least two sides the same length. (It is sometimes
|
7
|
+
specified as having exactly two sides the same length, but for the purposes of
|
8
|
+
this exercise we'll say at least two.)<br/>
|
9
|
+
A _scalene_ triangle has all sides of different lengths.
|
10
|
+
|
11
|
+
## Note
|
12
|
+
|
13
|
+
For a shape to be a triangle at all, all sides have to be of length > 0, and
|
14
|
+
the sum of the lengths of any two sides must be greater than or equal to the
|
15
|
+
length of the third side. See [Triangle Inequality](https://en.wikipedia.org/wiki/Triangle_inequality).
|
16
|
+
|
17
|
+
## Dig Deeper
|
18
|
+
|
19
|
+
The case where the sum of the lengths of two sides _equals_ that of the
|
20
|
+
third is known as a _degenerate_ triangle - it has zero area and looks like
|
21
|
+
a single line. Feel free to add your own code/tests to check for degenerate triangles.
|
22
|
+
## Setup
|
23
|
+
|
24
|
+
Check out [Exercism Help](http://exercism.io/languages/lisp) for instructions to
|
25
|
+
get started writing Common Lisp. That page will explain how to install and setup
|
26
|
+
a Lisp implementation and how to run the tests.
|
27
|
+
|
28
|
+
## Formatting
|
29
|
+
|
30
|
+
While Common Lisp doesn't care about indentation and layout of code,
|
31
|
+
nor whether you use spaces or tabs, this is an important consideration
|
32
|
+
for submissions to exercism.io. Excercism.io's code widget cannot
|
33
|
+
handle mixing of tab and space characters well so using only spaces is recommended to make
|
34
|
+
the code more readable to the human reviewers. Please review your
|
35
|
+
editors settings on how to accomplish this. Below are instructions for
|
36
|
+
popular editors for Common Lisp.
|
37
|
+
|
38
|
+
### VIM
|
39
|
+
|
40
|
+
Use the following commands to ensure VIM uses only spaces for
|
41
|
+
indentation:
|
42
|
+
|
43
|
+
```vimscript
|
44
|
+
:set tabstop=2
|
45
|
+
:set shiftwidth=2
|
46
|
+
:set expandtab
|
47
|
+
```
|
48
|
+
|
49
|
+
(or as a oneliner `:set tabstop=2 shiftwidth=2 expandtab`). This can
|
50
|
+
be added to your `~/.vimrc` file to use it all the time.
|
51
|
+
|
52
|
+
### Emacs
|
53
|
+
|
54
|
+
Emacs is very well suited for editing Common Lisp and has many
|
55
|
+
powerful add-on packages available. The only thing that one needs to
|
56
|
+
do with a stock emacs to make it work well with exercism.io is to
|
57
|
+
evaluate the following code:
|
58
|
+
|
59
|
+
`(setq indent-tab-mode nil)`
|
60
|
+
|
61
|
+
This can be placed in your `~/.emacs` (or `~/.emacs.d/init.el`) in
|
62
|
+
order to have it set whenever Emacs is launched.
|
63
|
+
|
64
|
+
One suggested add-on for Emacs and Common Lisp is
|
65
|
+
[SLIME](https://github.com/slime/slime) which offers tight integration
|
66
|
+
with the REPL; making iterative coding and testing very easy.
|
67
|
+
|
68
|
+
## Source
|
69
|
+
|
70
|
+
The Ruby Koans triangle project, parts 1 & 2 [http://rubykoans.com](http://rubykoans.com)
|
71
|
+
|
72
|
+
## Submitting Incomplete Solutions
|
73
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|