Skip to content

Commit

Permalink
Fix gara
Browse files Browse the repository at this point in the history
  • Loading branch information
alehander92 committed Sep 24, 2018
1 parent 42a8636 commit 51622e0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tests/test_experiment
tests/test_gara
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# nim-experiment
# gara

A nim macro-based pattern matching library.

### DSL

A library that provides a `match` macro which can be used as a pattern matching multibranch construct.
A `matches` macro which returns true if a value is matched. A `maybeMatches` macro which returns an `Option[tuple]` of the matched "variables".
A library that provides a `match` macro which can be used as a pattern matching construct.

A `matches` macro which returns true if a value is matched.

A `maybeMatches` macro which returns an `Option[tuple]` of the matched "variables".


```nim
Expand Down Expand Up @@ -78,10 +81,10 @@ matchDebug(a): # generates an error message describing the comparisons we had an
# or
echo lastMatchError() # if we detect this call, we generate an error message: we don't do it by default to not slow down the code
lastMatchError() # if we detect this call, we generate an error message: we don't do it by default to not slow down the code
```

With enough discipline we can generate pretty readable code from our macro.
With some discipline we can generate pretty readable code from our macro.
This would be also beneficial for the end user, as we can map his invocation with the generated code and help him
see the problem easily.

Expand Down Expand Up @@ -328,6 +331,10 @@ if c.isSome:
* error reporting
* fixes

### Name

gara means a train station in bulgarian. why a train station? I am travelling with trains these days, and I like bulgarian words.

### Questions and answers

**I don't like @name : it's bizarre and surprising for users**
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_experiment.nim → tests/test_gara.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
import experiment, strformat, strutils, sequtils, options
import gara, strformat, strutils, sequtils, options

type
Rectangle = object
Expand Down

0 comments on commit 51622e0

Please sign in to comment.