Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 0 additions & 22 deletions ProblemOfTheWeek.md

This file was deleted.

1 change: 1 addition & 0 deletions ProblemOfTheWeek.md
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Orange Combinator - Problem of the Week

# Problem of the week is here:

[ProblemOfTheWeek.md](/ProblemOfTheWeek.md)

## What is this

This repository holds the weekly problems for the Orange Combinator functional programming meetup. This activity serves as a learning activity for those new to FP and good practice for the seasoned veteran.
Expand Down
22 changes: 22 additions & 0 deletions submissions/poor-polynomials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Poor Polynomials

We want to represent polynomials using lists, such that the coefficients are stored from the most significant to the least significant. That is, the polynomial

```haskell
2x^3 - 3x^2 + 7
```

would be represented as

```haskell
[2,-3,0,7]
```

Propose a data type, `Poly`, such that it exhibits the following behavior:

* (1 points) The toPoly function allows you to receive an arbitrary list of numbers and "convert" it into a Poly.
* (1 points) The Show instance shows the polynomials in algebraic notation instead of a simple list.
* (1 point) The `addPoly p0 p1` function allows adding two polynomials.
* (2 points) The `evalPoly p x` function allows to evaluate the value of the polynomial `p` at point `x`.

You cannot use `length` or `reverse` in its implementation. To obtain all the points, the implementation of each function has to make a single pass through the list that internally represents the polynomial.