Python funkcionálně

by Martin Putniorz

Hacker and FP enthusiast

La divina commedia

Očistec

Deklarativnost

Amb

The Amb operator takes some number of expressions (or values if that's simpler in the language) and nondeterministically yields the one or fails if given no parameter, amb returns the value that doesn't lead to failure.

Rosetta code

Class based

Decorator based

Dobré, ale nelze plně využít

Pattern matching

Peklo Pythonu 2, očistec Pythonu 3

PEP 3132

Peklo

Actor model

The actor model in computer science is a mathematical model of concurrent computation that treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.

Wikipedia

Lepší přímá podpora

Erlang, Elixir, Scala, Rust

Tail recursion

Optimalizace bez eliminace

Mnoho dalšího

Python není funkcionální

BDFL nemá FP rád

(A svědomitě ho potírá)

Ráj

Lazy evaluation

In programming language theory, lazy evaluation, or call-by-need is an evaluation strategy which delays the evaluation of an expression until its value is needed (non-strict evaluation) and which also avoids repeated evaluations (sharing).

Wikipedia

Tools of trade

Iterační protokol

yield

yield / (yield) / yield from

Coroutines

Stream processing v Pythonu

Coroutine tutorial

Jedna z nejlepší featur

Nekonečné sekvence

s malým footprintem

A další

Času je málo,

informací hodně

Pro víc

Nebo oboje troje

Děkujeme

#

/