The document discusses Java 8 lambda expressions and how they can be used to filter, map, and reduce collections. It provides examples of filtering a list of employees to only those over age 60, mapping a list of employees to a list of their full names, and reducing a list of employees to calculate their total salary. It notes how lambda expressions allow bulk data operations on collections in a similar manner to SQL queries.
Catamorphims and junk in js. F-algebras at the end are cool. No Fx type necessary for now, but still works with it.
Lists and tuples are the main data types used to store multiple values in Python. Lists are ordered and changeable, while tuples are ordered and unchangeable. Some key differences are that lists use brackets and allow indexing, slicing, changing values, and other mutable operations, while tuples use parentheses and do not support mutable operations since values cannot be changed. Both support functions like append, length, checking for membership, and looping through values.
This document discusses lists in Ring programming language. It covers creating, accessing, modifying lists as well as common list operations like sorting, searching, reversing etc. Lists can contain other lists, allowing for nested data structures. Key points include: - Lists are created using square brackets or range operators. Items can be added or removed using functions like Add(), Del(). - The len() function returns the number of items in a list. Individual items can be accessed using their index in square brackets. - Common operations include sorting with sort(), reversing with reverse(), searching with find(). - Lists are passed by reference, so functions can modify the original list. They also support string indices to access items.
This document provides information about string, date, time, and mathematical functions in Ring programming language. It describes functions for string manipulation like substr(), strcmp(), str2list(), list2str(). It discusses date/time functions such as date(), time(), addDays(), diffDays(). It also covers data type checking, character checking, and conversion functions. Finally, it lists common mathematical functions in Ring like sin(), cos(), tan(), random(), sqrt().
This document provides documentation on mathematical functions available in the Ring programming language. It lists functions for trigonometric, hyperbolic, exponential, logarithmic, rounding and random number generation. Examples are given showing how to use functions like sin(), cos(), tan(), exp(), log(), ceil(), floor(), sqrt(), and random(). Conversions between radians and degrees are demonstrated for trigonometric functions.
This document provides an overview of the Scala programming language. It discusses Scala's JVM compatibility, basic data types like Int, Double, String, collections like List and Map, control flow structures like if/else and for loops, functions using def and =>, pattern matching, and common functions on collections like sum, length, and mean. It also shows examples of using Scala from the command line and with SBT.
学生向けScalaハンズオンテキスト part2 - パラメータ化された型 - 存在型 - 数値とモノイド - 多相と型クラス cf. part1: https://www.slideshare.net/opttechnologies/scala-handson-textbook-83475085
The document discusses functional programming concepts like pure functions, immutable data, and avoiding side effects. It compares imperative programming constructs like loops and mutable state to functional alternatives like map, filter, reduce. It argues that a functional style enables better reasoning about programs by avoiding side effects and complex control flow. Specific examples show transforming an imperative loop into a functional map and handling asynchronous code through chained promises or futures. Overall it advocates for a functional programming approach.
This document describes ScalaMeter, a performance regression testing framework. It discusses several problems that can occur when benchmarking code performance, including warmup effects from JIT compilation, interference from other processes, garbage collection triggering, and variability from other runtime events. It provides examples demonstrating these issues and discusses solutions like running benchmarks in a separate JVM, ignoring measurements impacted by garbage collection, and performing many repetitions to obtain a stable mean.
Playing with the Parallel collections in Scala and evaluating in which scenarios we would possibly use them.
for more information visit: http://salaboy.wordpress.com/2011/02/23/drools-5-community-training-announced-roadmap/
The document describes functions for removing nodes from the beginning and end of a singly linked list. It includes pseudocode for a removeFromBeginning function that removes the first node by updating the next pointer of the head, and a removeFromEnd function that iterates through the list to find the second to last node and sets its next pointer to null to remove the last node. Diagrams are provided showing the steps and changes to pointers when calling each function.
The document discusses several Kotlin advanced topics including delegated properties, lazy properties, objects, higher-order functions, lambdas, inline functions, and standard library functions like apply, also, let. It explains concepts like lazy initialization with lazy properties, property delegation, object expressions and declarations, functional programming with higher-order functions and lambdas, and inline functions for performance. It also covers utility functions in the standard library for working with objects and collections.
The document discusses various methods for working with strings in Ring programming language. Some key points include: - Strings can be defined using double or single quotes, and the : operator can be used to define strings as literals. - The len() function returns the length of a string. Functions like lower(), upper() can convert case, and left(), right() extract substrings. - Individual characters in a string can be accessed and modified using indexes. The trim() function removes leading/trailing spaces. - The copy() function duplicates a string, and lines() counts lines in a string. - The substr() function allows finding, extracting, and replacing substrings. strcmp() compares two
This document discusses ways to introduce functional programming concepts into Java code using existing Java 8 features, third-party libraries like Guava and LambdaJ, and by implementing common functional patterns and data structures yourself. It provides examples of using higher order functions, pure functions, recursion, and currying in Java code. It also summarizes capabilities of the Guava and LambdaJ libraries for functional programming in Java.
for more information visit: http://salaboy.wordpress.com/2011/02/23/drools-5-community-training-announced-roadmap/
This document discusses refactoring Java code to Clojure using macros. It provides examples of refactoring Java code that uses method chaining to equivalent Clojure code using the threading macros (->> and -<>). It also discusses other Clojure features like type hints, the doto macro, and polyglot projects using Leiningen.
This document discusses the author's first experience using lambda expressions in Java 8. It provides instructions on setting up Java 8 and examples of using lambda expressions for threads, collections, and mapping/reducing streams. Lambda expressions allow passing functionality as arguments to replace anonymous inner classes. The examples demonstrate using lambda expressions for runnables, foreach loops, and mapping/reducing operations. References for further reading on Java 8 lambdas are also included.