Giter Club home page Giter Club logo

gemini-presentation's Introduction

gemini-presentation

Presentation on Kotlin basics for my fellow team members.

Some brief notes on functional programming:

  • We aim for immutability of data types and collections if possible.
  • Instead, data is filtered, transformed, etc. into new collections or objects.
  • Side effects (e.g. as is common in OOP) are undesirable.
  • Referential transparency is a key idea: if we have a block of code:
performAction(myObject)

then we should be able to copy the code for performAction, substituting myObject inside for the parameter, and the result should be identical no matter how many times we invoke the statement, i.e. myObject is not affected and the return value should be consistent.

  • Side effects (which are necessary, e.g. printing to the screen, rendering UIs, reading in data) are confined and then "unleashed" at the end of setting everything up, which is called the "end of the world."

Functional Programming, according to ChatGPT:

Functional programming is a programming paradigm that emphasizes the use of functions to solve problems. The principles of functional programming include:

Immutability: Functional programming advocates immutability, meaning that once a value is assigned to a variable, it cannot be changed. Instead of modifying a value in place, a new value is created based on the old value and any modifications needed.

Pure functions: A pure function is a function that has no side effects and always returns the same output for a given input. Pure functions make it easier to reason about code and prevent unexpected behavior.

Higher-order functions: A higher-order function is a function that takes one or more functions as arguments and/or returns a function as its result. Higher-order functions enable code reuse and make it possible to write more generic and flexible code.

Recursion: Recursion is the process of defining a function in terms of itself. Functional programming heavily uses recursion to solve problems that involve repetitive processing.

Declarative programming: In declarative programming, the focus is on describing what needs to be done, rather than how it should be done. This makes it easier to reason about code and reduces the risk of introducing bugs.

Lazy evaluation: Lazy evaluation is a technique that defers the evaluation of an expression until its value is actually needed. This can help reduce memory usage and improve performance in some cases.

These principles work together to promote code that is easy to understand, test, and maintain. Functional programming is becoming increasingly popular, especially in areas such as data processing and scientific computing.

Fin.

gemini-presentation's People

Contributors

sraaphorst avatar

Watchers

 avatar

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.