GithubHelp home page GithubHelp logo

elixir-koans's People

Contributors

codefupanda avatar cohen-carlisle avatar cybrox avatar denheck avatar ericengineered avatar felipesere avatar foucist avatar gemcfadyen avatar gpouilloux avatar huyz avatar iamvery avatar iftakharpy avatar imahmedismail avatar jechol avatar jgandt avatar kknives avatar maikon avatar marosluuce avatar medoror avatar nagasaki45 avatar pineman avatar rabeagleissner avatar rafax avatar riacataquian avatar s-oram avatar selfsimilar avatar simonedamico avatar snikolau avatar ukutaht avatar vise890 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elixir-koans's Issues

Wrong ordering of Koans

After running mix meditate, the koans starts with 10_processes.ex instead of 01_equalities.ex in ubuntu linux 15.10.

EDIT: no problem with ubuntu 16.04

Nested Dictionary Structures

I am working my way through "Programming Elixir 1.3"
Chapter 8 - Nested Dictionary Structures
http://bit.ly/2kgQ5si

Uses get_in, put_in, update_in, and get_and_update_in. Should I modify one of the existing koans [maps, map_sets, structs]? or create a new one.

Improve descriptions

More of a placeholder issue. We should go over the descriptions, make sure they're consistent and maybe try to rewrite some of them to be more koan-style.

Map koans lack clarity when it comes to ordering

The koan "You can get all the keys from the map” had me scratching my head for a little while. The order of Map.keys (and Map.values) appears to come out in alphabetical order, not insertion order. Maybe the koan could be renamed to suggest that there is an implicit ordering, or perhaps have a test helper that checks two arrays just contain the same elements in any order?

The "unordered MapSet" koan is very unclear

The koan that shows that MapSets aren't ordered is confusing:

koan "Even though I am like a list I am unordered after 32 elements" do
    assert 1..33 |> MapSet.new() |> Enum.fetch(0) == {___, 11}
end

There are two reasons:

  1. "after 32 elements" is grammatically misleading and the number 32 is unexplained.
  2. It's unclear to beginners where the number 11 comes from. For those who understand where the 11 could come from (some incidental determinism?), it seems that this koan is brittle as there's no guarantee that the runtime would put this item in the beginning (I assume).

Deal with compiler warnings

Things like
lib/koans/08_structs.ex:9: warning: this check/guard will always yield the same result
should be cleared.

Handle unary failures more elegantly

Currently failures for assertions such as assert match?(1,2) are displayed as if they're being made on binary statements. Here's an example:

Now meditate upon PatternMatching
|==>                           | 7 of 73
----------------------------------------
The pattern can make assertions about what it expects
Assertion failed in lib/koans/12_pattern_matching.ex:49
match?([1, _second, _third], [1])

left:  :ex_unit_no_meaningful_value
right: [1]

This unfortunately leaks ExUnit's :ex_unit_no_meaningful_value detail through and causes confusion (see #143) to learners.

I believe the solution would be to handle these so-called "unary" (i.e. one argument) assertions different than so-called "binary" assertions.

If I have some time to look at it I will. Just reporting this issue in case it goes to someone else ❤️

Koans about Date and Time

For me it was a nice thing to know about ways to work with them, especially about NaiveDateTime sigil, which was not obvious.
If you also think that's nice, I can PR the couple of koans about them

Could not compile dependency :fs error

After running mix deps.get successfully, running mix meditate results in the following error:

===> Compiling fs
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
** (Mix) Could not compile dependency :fs, "/home/jeff/.mix/rebar3 bare compile --paths "/home/jeff/projects/elixir/elixir-koans/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile fs", update it with "mix deps.update fs" or clean it with "mix deps.clean fs"

rebar3 report "mix meditate":

Rebar3 report
 version 3.3.5+build.3719.ref4725d36
 generated at 2017-02-16T15:47:48+00:00
=================
Please submit this along with your issue at https://github.com/erlang/rebar3/issues (and feel free to edit out private information, if any)
-----------------
Task: mix
Entered as:
  mix meditate
-----------------
Operating System: x86_64-unknown-linux-gnu
ERTS: Erlang/OTP 19 [erts-8.2.2] [source-1ca84a4] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
Root Directory: /usr/lib/erlang
Library directory: /usr/lib/erlang/lib
-----------------
Loaded Applications:
bbmustache: 1.3.0
certifi: 0.4.0
cf: 0.2.2
common_test: 1.13
compiler: 7.0.3
crypto: 3.7.2
cth_readable: 1.2.3
dialyzer: 3.0.3
edoc: 0.8.1
erlware_commons: 1.0.0
eunit: 2.3.2
eunit_formatters: 0.3.1
getopt: 0.8.2
inets: 6.3.5
kernel: 5.1.1
providers: 1.6.0
public_key: 1.3
relx: 3.22.2
sasl: 3.0.2
snmp: 5.2.4
ssl_verify_fun: 1.1.1
stdlib: 3.2
syntax_tools: 2.1.1
tools: 2.9

-----------------
Escript path: undefined
Providers:
  app_discovery as clean compile compile cover ct deps dialyzer do edoc escriptize eunit get-deps help install install_deps list lock new path pkgs release relup report shell state tar tree unlock update upgrade upgrade upgrade version xref

Results of DEBUG=1 mix meditate:

Pastebin of stacktrace

System:
Ubuntu 16.04.2
4.4.0-62-generic

Let me know if I can provide any other info...

Progress display messed up due to recent change

I accidentally introduced a change that messed up the progress display a little while back. I've got a fix coming up, but I'm creating this issue so that I can link to something with pictures in the commit notes.

The problematic change failures to unwrap the koan body from it the keyword list argument, and therefore the display cannot be formatted correctly while running the koans.

Currently, it looks like this at it worst:
screen shot 2016-12-23 at 8 52 22 am

However, only the offending line is supposed to be displayed:
screen shot 2016-12-23 at 8 52 35 am

Fix incoming...

Figure out how to support multiple blanks per koan

We have some koans that show 'symmetric' behaviour.
It would be nice to keep both asserts in there exemplify that behaviour:

  def the_length(0), do: "It was zero"
  def the_length(number), do: "The length was #{number}"
  koan "You can also 'guard' with concrete values" do
    assert the_length(0) == "It was zero"
    assert the_length(5) == "The length was 5"
  end

Necessary parts:

  • update the AST mangler to support lists of replacements
  • update the koan macro to inject values as needed

Autoreload doesn't work on macbook

I'm trying to make koans, but it shows me an error every time I save the edited file:

** (Code.LoadError) could not load /sandbox/elixir_koans/elixir-koans/lib/koans/05_maps.ex___jb_tmp___
(elixir) lib/code.ex:662: Code.find_file/2
(elixir) lib/code.ex:319: Code.load_file/2

I have Macbook Pro with Retina 2015, fresh installed, the newest Elixir(1.2.4) from Homebrew

Format runtime errors

If you add

raise "boo"

To a koan, you can observe what happens when we get a random runtime error in a koan. The stacktrace gets printed which is fine but I'd like to decorate that similarly to how we decorate ExUnit assertions (mention which koan was running, clear the screen etc)

Strip out answers

We should think about keeping an answer sheet around still. The ideal would be:

  • Koans have blanks in them
  • There's an answer sheet in some format
  • An automatic test to make sure that all koans pass with the provided answers

Automatic screen clearing

The UX could be improved by clearing the screen and always showing failures in one place on the screen. I think this feature should be switchable though. Not everyone may want to use it. I am unsure whether auto-clearing should be the default or the other way around.

assert_receive not compatible with strategy for multiple answers

This isn't a very big deal, but I wanted to report it in case it became relevant.

Problem

The current strategy for answering a koan with multiple blanks during test is not compatible with assert_receive.

As we've found in #93, the expression given to assert_receive is used as a match in a receive call that is generated by the macro. The current strategy for inserting multiple answers is to replace blanks (___) with generated expressions, e.g. elem(answers, 0). However the expression elem(list, index) is not a valid match, which breaks compilation.

» mix test
Compiled lib/runner.ex

== Compilation error on file lib/koans/10_processes.ex ==
** (CompileError) lib/koans/10_processes.ex:18: illegal pattern
    (stdlib) lists.erl:1337: :lists.foreach/2
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6

Again, this really isn't an issue until we have koans missing multiple answers and using assert_receive (or any other macro that expects its expression to be used in a match), but it seems worth reporting while the problem is understood. Also as you can see the error is cryptic and hard to debug.

Handle compile errors more gracefully

When the user saves a file with a compile error, the auto-runner does the right thing and keeps running, but the error is a bit scary:

screen shot 2016-01-08 at 15 54 37

Most of this is irrelevant to the user and we should be able to get rid of it.

mix meditate is not reloading files

Hello-

I am running the koans (I checked out master from git) and when I run mix meditate, then edit a koan file, it does not re-run the koans. I am on ubuntu 16.04, i installer elixir from erlang solutions ppa, and also installed inotify-tools using apt. Any suggestions how to debug? Thanks!

:ex_unit_no_meaningful_value error in 12. pattern matching

Now meditate upon PatternMatching
|==================>           | 114 of 180
----------------------------------------
The pattern can make assertions about what it expects
Assertion failed in lib/koans/12_pattern_matching.ex:49
match?([1, _second, _third], :error)

left:  :ex_unit_no_meaningful_value
right: :error

Updated:

  koan "The pattern can make assertions about what it expects" do
    assert match?([1, _second, _third], :ex_unit_no_meaningful_value)
  end

Result:

Now meditate upon PatternMatching
|==================>           | 114 of 180
----------------------------------------
The pattern can make assertions about what it expects
Assertion failed in lib/koans/12_pattern_matching.ex:49
match?([1, _second, _third], :ex_unit_no_meaningful_value)

What am I missing here?

Allow blanks in the koans

In the spirit of koans, we need to leave a blank inside every koan that users need to fill out. My thought is to make double underscore: __ signify a blank. There should be some crazy macro tricks to allow this while making the runner still print the line and give nice output.

License?

Can a license file get added to this project?

"mix meditate" gives Assertion failed error

Just installed elixir yesterday with brew install elixir. Cloned this repo today and ran mix deps.get. Upon running mix meditate, this error occurs ("Assertion failed")

> mix meditate
warning: variable "deps" does not exist and is being expanded to "deps()", please use parentheses to remove the ambiguity or change the variable name
  mix.exs:9

Welcome to the Elixir koans.
Let these be your first humble steps towards learning a new language.

The path laid in front of you is one of many.


Now meditate upon Equalities
|                              | 0 of 182
----------------------------------------
We shall contemplate truth by testing reality, via equality
Assertion failed in lib/koans/01_equalities.ex:12
true == ___

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.