Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ce0e95d
accumulate stub file
Jan 25, 2020
dc7f3a8
Anagram stub file
Jan 25, 2020
62c66a4
Atbash stub file
Jan 25, 2020
b04a451
beer-song stub file
Jan 25, 2020
be5acca
validates strand (#115)
Jan 26, 2020
f6f18d8
rename test files (#118)
Jan 26, 2020
a424826
Update INSTALLATION.md
Jan 26, 2020
01f00c5
remove .meta from bob (#119)
Jan 27, 2020
5e7e05e
update luhn tests to newest canonical data (#120)
Jan 27, 2020
d8b11e1
fix luhn test description (oops)
Jan 27, 2020
9a9c0fa
renaming and change quotes (#121)
Jan 27, 2020
d39d0c8
Update README.md
Jan 27, 2020
aa9af63
accumulate stub file
Jan 25, 2020
e732d8f
Anagram stub file
Jan 25, 2020
55aa8ad
Atbash stub file
Jan 25, 2020
bce3e81
fix conflict
Jan 27, 2020
6dcf60e
binary stub file
Jan 27, 2020
0f78635
binary-search-tree stub file
Jan 27, 2020
9ae3a59
binary-search-tree stub file
Jan 27, 2020
5284d18
bob stub file
Jan 27, 2020
ca63f80
hello-world stub file
Jan 27, 2020
8b932da
hexadecimal stub file
Jan 27, 2020
a3b261e
fix binary
Jan 27, 2020
d14a7d7
fix atbash-cipher
Jan 27, 2020
03ded41
fix beer-song
Jan 27, 2020
512800f
fix binary
Jan 27, 2020
c7b0e47
fix binary-search-tree
Jan 27, 2020
a99d8e8
fix beer-song
Jan 27, 2020
49a7986
fix atbash-cipher
Jan 27, 2020
06c96ec
fix binary-search-tree
Jan 27, 2020
dd61665
linked-list stub file
Jan 27, 2020
332d420
linked-list stub file
Jan 27, 2020
b30430d
luhn stub file
Jan 27, 2020
22608ec
nth-prime stub file
Jan 27, 2020
a00ce02
nucleotide-count stub file
Jan 27, 2020
fc3ca6d
nucleotide-count stub file
Jan 27, 2020
5760e60
palindrome-products stub file
Jan 27, 2020
5969f3b
pascals-triangle stub file
Jan 27, 2020
6e3573e
queen-attack stub file
Jan 27, 2020
71afa64
triangle stub file
Jan 27, 2020
ba02f36
trinary stub file
Jan 27, 2020
0dc956a
word-count stub file
Jan 27, 2020
e45977e
wordy stub file
Jan 27, 2020
78a82d9
fix conflicts
Jan 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# xCoffeeScript
# CoffeeScript

Exercism exercises in CoffeeScript

Expand Down
6 changes: 3 additions & 3 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

[linstall]: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

Install `jasmine-node` and `coffee`:
Install `jasmine-node` and `coffeescript`:

```bash
$ npm install jasmine-node coffeescript -g
$ npm install -g jasmine-node coffeescript
```

Depending on your setup, you may need super user privileges to install an `npm` module globally. This is the case if you've used the official installer linked to above. If NPM gives you an error saying you don't have access, add `sudo` to the command above:

```bash
$ sudo npm install jasmine-node coffeescript -g
$ sudo npm install -g jasmine-node coffeescript
```

If you've used the official installer, your `PATH` should have been automatically configured, but if your shell has trouble locating your globally installed modules--or if you build Node.js from source--update your `PATH` to include the `npm` binaries by adding the following to either `~/.bash_profile` or `~/.zshrc`:
Expand Down
3 changes: 3 additions & 0 deletions exercises/accumulate/accumulate.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This is a stub file for the CoffeeScript track

Array::accumulate = (args) ->
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ describe '[].accumulate()', ->
accumulator = (word) -> word.split('').reverse().join('')
result = 'the quick brown fox etc'.split(/\s/).accumulate accumulator

expect(result).toEqual ["eht", "kciuq", "nworb", "xof", "cte"]
expect(result).toEqual ['eht', 'kciuq', 'nworb', 'xof', 'cte']

xit 'accumulate recursively', ->
result = 'a b c'.split(/\s+/).accumulate (char) ->
'1 2 3'.split(/\s+/).accumulate (digit) -> "#{char}#{digit}"
'1 2 3'.split(/\s+/).accumulate (digit) -> '#{char}#{digit}'

expect(result).toEqual([["a1", "a2", "a3"], ["b1", "b2", "b3"], ["c1", "c2", "c3"]])
expect(result).toEqual([['a1', 'a2', 'a3'], ['b1', 'b2', 'b3'], ['c1', 'c2', 'c3']])
8 changes: 8 additions & 0 deletions exercises/anagram/anagram.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a stub file for the CoffeeScript track

class Anagram
constructor: (args) ->

match: (targets) ->

module.exports = Anagram
56 changes: 56 additions & 0 deletions exercises/anagram/anagram.spec.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Anagram = require './anagram'
describe 'Anagram', ->
it 'no matches', ->
detector = new Anagram 'diaper'
matches = detector.match ['hello', 'world', 'zombies', 'pants']
expect(matches).toEqual []

xit 'detects simple anagram', ->
detector = new Anagram 'ant'
matches = detector.match ['tan', 'stand', 'at']
expect(matches).toEqual ['tan']

xit 'does not detect false positives', ->
detector = new Anagram 'galea'
matches = detector.match ['eagle']
expect(matches).toEqual []

xit 'detects multiple anagrams', ->
detector = new Anagram 'master'
matches = detector.match ['stream', 'pigeon', 'maters']
expect(matches).toEqual ['stream', 'maters']

xit 'does not detect anagram subsets', ->
detector = new Anagram 'good'
matches = detector.match ['dog', 'goody']
expect(matches).toEqual []

xit 'detects anagram', ->
detector = new Anagram 'listen'
matches = detector.match ['enlists', 'google', 'inlets', 'banana']
expect(matches).toEqual ['inlets']

xit 'detects multiple anagrams', ->
detector = new Anagram 'allergy'
matches = detector.match ['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading']
expect(matches).toEqual ['gallery', 'regally', 'largely']

xit 'does not detect identical words', ->
detector = new Anagram 'corn'
matches = detector.match ['corn', 'dark', 'Corn', 'rank', 'CORN', 'cron', 'park']
expect(matches).toEqual ['cron']

xit 'does not detect non-anagrams with identical checksum', ->
detector = new Anagram 'mass'
matches = detector.match ['last']
expect(matches).toEqual []

xit 'detects anagrams using case-insensitive subject', ->
detector = new Anagram 'Orchestra'
matches = detector.match ['cashregister', 'carthorse', 'radishes']
expect(matches).toEqual ['carthorse']

xit 'detects anagrams using case-insensitive candidates', ->
detector = new Anagram 'orchestra'
matches = detector.match ['cashregister', 'Carthorse', 'radishes']
expect(matches).toEqual ['carthorse']
56 changes: 0 additions & 56 deletions exercises/anagram/anagram_test.spec.coffee

This file was deleted.

6 changes: 6 additions & 0 deletions exercises/atbash-cipher/atbash-cipher.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This is a stub file for the CoffeeScript track

class AtbashCipher
encode: (args) ->

module.exports = AtbashCipher
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Atbash = require './atbash'
Atbash = require './atbash-cipher'

describe 'Atbash', ->
it 'encodes no', ->
Expand Down
5 changes: 5 additions & 0 deletions exercises/atbash-cipher/atbash.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Atbash

@encode: (args) ->

module.exports = Atbash
8 changes: 8 additions & 0 deletions exercises/beer-song/beer-song.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a stub file for the CoffeeScript track

class BeerSong
verse: (args) ->

sing: (args) ->

module.exports = BeerSong
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
Beer = require("./beer")
describe "Beer", ->
it "prints an arbitrary verse", ->
expect(Beer.verse 8).toEqual """
Beer = require './beer-song'
describe 'Beer', ->
it 'prints an arbitrary verse', ->
expect(Beer.verse 8).toEqual '
8 bottles of beer on the wall, 8 bottles of beer.
Take one down and pass it around, 7 bottles of beer on the wall.
"""
'

xit "handles 1 bottle", ->
expect(Beer.verse 1).toEqual """
xit 'handles 1 bottle', ->
expect(Beer.verse 1).toEqual '
1 bottle of beer on the wall, 1 bottle of beer.
Take it down and pass it around, no more bottles of beer on the wall.
"""
'

xit "handles 0 bottles", ->
expect(Beer.verse 0).toEqual """
xit 'handles 0 bottles', ->
expect(Beer.verse 0).toEqual '
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
"""
'

xit "sings several verses", ->
expect(Beer.sing 8, 6).toEqual """
xit 'sings several verses', ->
expect(Beer.sing 8, 6).toEqual '
8 bottles of beer on the wall, 8 bottles of beer.
Take one down and pass it around, 7 bottles of beer on the wall.

Expand All @@ -29,10 +29,10 @@ describe "Beer", ->
6 bottles of beer on the wall, 6 bottles of beer.
Take one down and pass it around, 5 bottles of beer on the wall.

"""
'

xit "sings the rest of the verses", ->
expect(Beer.sing 3).toEqual """
xit 'sings the rest of the verses', ->
expect(Beer.sing 3).toEqual '
3 bottles of beer on the wall, 3 bottles of beer.
Take one down and pass it around, 2 bottles of beer on the wall.

Expand All @@ -45,6 +45,11 @@ describe "Beer", ->
No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.

<<<<<<< HEAD:exercises/beer-song/beer-song.spec.coffee
'
=======
"""


<<<<<<< HEAD:exercises/beer-song/beer-song.spec.coffee
>>>>>>> beer-song stub file:exercises/beer-song/beer-song_test.spec.coffee
=======
>>>>>>> b04a45190849e2f4cb3f56024234c4da51df9ab7:exercises/beer-song/beer-song_test.spec.coffee
9 changes: 9 additions & 0 deletions exercises/binary-search-tree/binary-search-tree.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This is a stub file for the CoffeeScript track
class BinarySearchTree
constructor: (args) ->

insert: (args) ->

data: ->

module.exports = BinarySearchTree
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Bst = require './bst'
BinarySearchTree = require './binary-search-tree'

recordAllData = (bst) ->
out = []
Expand All @@ -8,31 +8,31 @@ recordAllData = (bst) ->
describe 'BinarySearchTree', ->

it 'data is retained', ->
expect(4).toEqual new Bst(4).data
expect(4).toEqual new BinarySearchTree(4).data

xit 'inserting less', ->
four = new Bst(4)
four = new BinarySearchTree(4)
four.insert(2)

expect(four.data).toEqual 4
expect(four.left.data).toEqual 2

xit 'inserting same', ->
four = new Bst(4)
four = new BinarySearchTree(4)
four.insert(4)

expect(four.data).toEqual 4
expect(four.left.data).toEqual 4

xit 'inserting right', ->
four = new Bst(4)
four = new BinarySearchTree(4)
four.insert(5)

expect(four.data).toEqual 4
expect(four.right.data).toEqual

xit 'complex tree', ->
four = new Bst(4)
four = new BinarySearchTree(4)
four.insert(2)
four.insert(6)
four.insert(1)
Expand All @@ -49,22 +49,22 @@ describe 'BinarySearchTree', ->
expect(four.right.right.data).toEqual 7

xit 'iterating one element', ->
expect(recordAllData(new Bst(4))).toEqual [4]
expect(recordAllData(new BinarySearchTree(4))).toEqual [4]

xit 'iterating over smaller element', ->
four = new Bst(4)
four = new BinarySearchTree(4)
four.insert(2)

expect(recordAllData(four)).toEqual [2, 4]

xit 'iterating over larger element', ->
four = new Bst(4)
four = new BinarySearchTree(4)
four.insert(5)

expect(recordAllData(four)).toEqual [4, 5]

xit 'iterating over complex tree', ->
four = new Bst(4)
four = new BinarySearchTree(4)
four.insert(2)
four.insert(1)
four.insert(3)
Expand Down
8 changes: 8 additions & 0 deletions exercises/binary/binary.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a stub file for the CoffeeScript track

class Binary
constructor: (args) ->

toDecimal: ->

module.exports = Binary
10 changes: 0 additions & 10 deletions exercises/bob/.meta/description.md

This file was deleted.

4 changes: 4 additions & 0 deletions exercises/bob/bob.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Bob
hey: (args) ->

module.exports = Bob
Loading