-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Instructions | ||
|
||
Your task is to determine what you will say as you give away the extra cookie. | ||
|
||
If you know the person's name (e.g. if they're named Do-yun), then you will say: | ||
|
||
```text | ||
One for Do-yun, one for me. | ||
``` | ||
|
||
If you don't know the person's name, you will say _you_ instead. | ||
|
||
```text | ||
One for you, one for me. | ||
``` | ||
|
||
Here are some examples: | ||
|
||
| Name | Dialogue | | ||
| :----- | :-------------------------- | | ||
| Alice | One for Alice, one for me. | | ||
| Bohdan | One for Bohdan, one for me. | | ||
| | One for you, one for me. | | ||
| Zaphod | One for Zaphod, one for me. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Introduction | ||
|
||
In some English accents, when you say "two for" quickly, it sounds like "two fer". | ||
Two-for-one is a way of saying that if you buy one, you also get one for free. | ||
So the phrase "two-fer" often implies a two-for-one offer. | ||
|
||
Imagine a bakery that has a holiday offer where you can buy two cookies for the price of one ("two-fer one!"). | ||
You take the offer and (very generously) decide to give the extra cookie to someone else in the queue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## -*- conf -*- | ||
.rebar3 | ||
_build/ | ||
ebin/ | ||
erl_crash.dump | ||
rebar3.crashdump | ||
|
||
tmp | ||
bin/configlet | ||
bin/configlet.exe | ||
CHECKLIST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"authors": [ | ||
"BNAndras" | ||
], | ||
"files": { | ||
"solution": [ | ||
"src/two-fer.lfe" | ||
], | ||
"test": [ | ||
"test/two-fer-tests.lfe" | ||
], | ||
"example": [ | ||
".meta/example.lfe" | ||
] | ||
}, | ||
"blurb": "Create a sentence of the form \"One for X, one for me.\".", | ||
"source_url": "https://github.com/exercism/problem-specifications/issues/757" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(defmodule two-fer | ||
(export (two-fer 1))) | ||
|
||
(defun two-fer | ||
(("") "One for you, one for me.") | ||
((name) (++ "One for " name ", one for me."))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This is an auto-generated file. | ||
# | ||
# Regenerating this file via `configlet sync` will: | ||
# - Recreate every `description` key/value pair | ||
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications | ||
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) | ||
# - Preserve any other key/value pair | ||
# | ||
# As user-added comments (using the # character) will be removed when this file | ||
# is regenerated, comments can be added via a `comment` key. | ||
|
||
[1cf3e15a-a3d7-4a87-aeb3-ba1b43bc8dce] | ||
description = "no name given" | ||
|
||
[b4c6dbb8-b4fb-42c2-bafd-10785abe7709] | ||
description = "a name given" | ||
|
||
[3549048d-1a6e-4653-9a79-b0bda163e8d5] | ||
description = "another name given" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ERL := $(shell which erl) | ||
REBAR3 := $(shell which rebar3) | ||
|
||
null := | ||
space := $(null) # | ||
comma := , | ||
|
||
ifeq ($(ERL),) | ||
$(error Can't find Erlang executable 'erl') | ||
else ifeq ($(REBAR3),) | ||
$(error Can't find rebar3) | ||
endif | ||
|
||
compile: ; $(REBAR3) compile | ||
|
||
clean: ; $(REBAR3) clean | ||
|
||
.PHONY: test | ||
test: | ||
$(REBAR3) eunit \ | ||
-m $(subst $(space),$(comma),$(basename $(notdir $(wildcard test/*.lfe)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{plugins, [{rebar3_lfe, "0.4.3"}]}. | ||
|
||
{provider_hooks, [{post, [{compile, {lfe, compile}}]}]}. | ||
|
||
{deps, [{lfe, "2.1.1"}]}. | ||
|
||
{profiles, | ||
[{test, | ||
[{eunit_compile_opts, [{src_dirs, ["src", "test"]}]}, | ||
{deps, | ||
[{ltest, "0.13.3"}]}]}]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{"1.2.0", | ||
[{<<"lfe">>,{pkg,<<"lfe">>,<<"2.1.1">>},0}]}. | ||
[ | ||
{pkg_hash,[ | ||
{<<"lfe">>, <<"4A888B26172D198DC7A5AFEB897E8248AF7D56E1638D9C8249AAF933AE811B96">>}]}, | ||
{pkg_hash_ext,[ | ||
{<<"lfe">>, <<"C484D3B655D40DED58BC41B17B22F173711C681BF36063A234A9BAA9506947E1">>}]} | ||
]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
%% -*- erlang -*- | ||
{application, 'two-fer', | ||
[{description, ""}, | ||
{vsn, "0.0.1"}, | ||
{modules, | ||
['two-fer']}, | ||
{registered, []}, | ||
{applications, | ||
[kernel, stdlib]}, | ||
{included_applications, []}, | ||
{env, []}]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(defmodule two-fer | ||
(export (two-fer 1))) | ||
|
||
; please define the two-fer function. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
(defmodule two-fer-tests | ||
(behaviour ltest-unit) | ||
(export all)) | ||
|
||
(include-lib "ltest/include/ltest-macros.lfe") | ||
|
||
(deftest no-name-given | ||
(is-equal "One for you, one for me." (two-fer:two-fer ""))) | ||
|
||
(deftest a-name-given | ||
(is-equal "One for Alice, one for me." (two-fer:two-fer "Alice"))) | ||
|
||
(deftest another-name-given | ||
(is-equal "One for Bob, one for me." (two-fer:two-fer "Bob"))) |