GithubHelp home page GithubHelp logo

fpinkotlin's People

Contributors

alex023 avatar ashishkujoy avatar doubleirish avatar dpapathanasiou avatar enshahar avatar lgaida avatar mrbergin avatar pysa avatar pysaumont avatar vptheron 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

fpinkotlin's Issues

Error in Readme.md

In the description of how to run a single test you have

    gradle :fpinkotlin-advancedlisthandling-exercises:test --tests com.fpinkotlin.advancedlisthandling.exercise01.ListTest

However, when I run this command without making any modifications to the projects (don't implement the required functionality) I don't get an error. Apparently, this is because the given test doesn't exist. If, instead, I run:

    gradle :fpinkotlin-advancedlisthandling-exercises:test --tests com.fpinkotlin.advancedlisthandling.exercise02.ListTest

I do, indeed, see an error (note the use of exercise02 instead of exercise01).

Problems with the Gradle-Wrapper

With the commited ( fpinkotlin/fpinkotlin-parent/gradle/wrapper/gradle-wrapper.properties
) version 2.2.1 of gradle-wrapper I get the following error if I try to build the project:

  • What went wrong:
    A problem occurred configuring root project 'fpinkotlin-parent'.

Failed to notify project evaluation listener.
org.gradle.api.Project.getPluginManager()Lorg/gradle/api/plugins/PluginManager;
org.gradle.api.Project.getPluginManager()Lorg/gradle/api/plugins/PluginManager;

If I updated the version to 4.6 everything works fine

Test for exercise 4.1 should only test positive Ints

Currently the test for exercise 4.1 will run with negative Ints. The exercise asks for a function "add" that works on positive Ints.

Since the test generates cases with negative Ints you could either end up with a stack overflow or a never ending function (depending on implementation).

Wrong solution to exercise 4.1

The solution to add two numbers is incorrect and works purely by accident only because types of both inputs are Int. If one of them is changed to Long, the answers would be incorrect. Also very simple addition like add(3, -3) will result in a stackoverflow if the function is not marked tailrec because it takes 2^32 - 3 iterations to get b from -3 to 0.

Provided solution is tailrec fun add(x: Int, y: Int): Int = if (y == 0) x else add(inc(x), dec(y)).
The correct solution would be

tailrec fun add(a: Int, b: Int): Int =
    when {
        (b == 0) -> a
        (b > 0) -> add(inc(a), dec(b))
        else -> add(dec(a), inc(b))
    }

Project won't build with Java 14 (and Gradle 6.1)

At the current state of the project the build will fail with installed JDK 14 (I use Adopt Open JDK 14).

This seems to be a known Bug of Gradle.
I used this simple workaround described in the comments here.

Just change the file \fpinkotlin\fpinkotlin-parent\gradle\wrapper\gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip
#                                                                   ^
#                                                                   6 instead of 1 to upgrade the version of Gradle
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

After this change the project compiles.

Ch 9 Working With Laziness Exercise 28 Test Bug

The test for this exercise may be insufficient because it passes the case where the fibonacci stream produces only zeros.

z + y == x will always be true when z, x, y are 0. But this sequence isn't fibonacci.

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.