Content-Length: 10154 | pFad | http://hackage.haskell.org/package/Jikka-5.6.0.0/docs/Jikka-Core-Convert-SpecializeFoldl.html

Jikka.Core.Convert.SpecializeFoldl
Jikka-5.6.0.0: A transpiler from Python to C++ for competitive programming
Copyright(c) Kimiyuki Onaka 2021
LicenseApache License 2.0
Maintainerkimiyuki95@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Jikka.Core.Convert.SpecializeFoldl

Description

\[ \newcommand\int{\mathbf{int}} \newcommand\bool{\mathbf{bool}} \newcommand\list{\mathbf{list}} \]

Synopsis

Documentation

run :: (MonadAlpha m, MonadError Error m) => Program -> m Program Source #

run reduces summations and products.

Example

Before:

foldl (fun x y -> x + y) 0 xs

After:

sum xs

List of builtin functions which are reduced

Source functions

  • Foldl \(: \forall \alpha \beta. (\beta \to \alpha \to \beta) \to \beta \to \list(\alpha) \to \beta\)

Destination functions

  • Sum \(: \list(\int) \to \int\)
  • Product \(: \list(\int) \to \int\)
  • ModSum \(: \list(\int) \to \int \to \int\)
  • ModProduct \(: \list(\int) \to \int \to \int\)
  • All \(: \list(\bool) \to \bool\)
  • Any \(: \list(\bool) \to \bool\)
  • Max1 \(: \forall \alpha. \list(\alpha) \to \alpha\)
  • Min1 \(: \forall \alpha. \list(\alpha) \to \alpha\)
  • Iterate \(: \forall \alpha. \int \to (\alpha \to \alpha) \to \alpha \to \alpha\)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://hackage.haskell.org/package/Jikka-5.6.0.0/docs/Jikka-Core-Convert-SpecializeFoldl.html

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy