Taming the C++ Filter Viewstd::cout << *pos << '\n'; ++pos; if (pos != v2.end ## Pipelines: Lazy Evaluation std::vectorcoll{8, 15, 7, 0, 9}; // define a view on coll: auto vColl = coll | std::views::filter([] transform 15 val: -15 filter 7 filter 0 transform 0 val: 0 filter 9 transform 9 val: -9 Pull model (lazy evaluation): next element and its value are processed on demand josuttis | eckstein ## Pipelines: Price 0 码力 | 43 页 | 2.77 MB | 1 年前3
From Eager Futures/Promises to Lazy Continuations: Evolving an Actor Library Based on Lessons Learned## From Eager Futures/Promises to Lazy Continuations Evolving an Actor Library Based on Lessons Learned from Large-Scale Deployments ## prologue • past life at UC Berkeley, Twitter, Mesosphere/D2iQ std::move(body), std::move(k)}; ## lazy continuations auto k = http::Post(url, body, /* k */); resulting type is the “computational graph” ## lazy continuations auto k = http::Post(url, body the “computational graph” - the graph is lazy, i.e., nothing has started when we get it (tradeoff for dynamic allocation) and must be explicitly started ## lazy continuations auto k = http::Post(url, body0 码力 | 264 页 | 588.96 KB | 1 年前3
More Ranges Pleasein-place or output-iterator nature of C++98 algorithms Range Adaptors - algorithms encalsupated as ‘lazy ranges’ (views) ☑ Algorithms as composable objects - ‘expression templates’ ☐ Projections - unary arguments and results ranges::reverse(ranges::search(str,"abc"sv));qodbolt • Views as composable lazy ranges str | views::split(' ') | views::take(2);godbolt • Views have a value/algorithm duality Rank increasing - tuples: zip*, enumerate*, cartesian_product*, adjacent* Rank increasing - ranges: {lazy}split, slide*, chunk{by}* • Committee plan for C++23 is in P2214 ## Digression - Algorithm Selection0 码力 | 27 页 | 1.08 MB | 1 年前3
Thinking Functionally In C++add(Mash(banana)); return ingredient; }); } ## Part 4: Lazy Evaluation ## Lazy Evaluation Delay actions or calculations until they are needed class Data { public: DataType .GetType())) { return; } UseData(maybeNeededData.GetBuffer()); } ## Lazy Evaluation: Allocation ## Delay actions or calculations until they are needed class Data { public: .GetType())) { return; } UseData(maybeNeededData.GetBuffer()); } ## Lazy Evaluation: Fetch data lazily std::vectorMap::GetCitiesInBoundary(LatLonBounds boundary) { // 0 码力 | 114 页 | 3.14 MB | 1 年前3
The Idris Tutorial Version 0.99http://www.idris-lang.org/ Type :? for help Idris> This gives a ghci style interface which allows evaluation of, as well as type checking of, expressions; theorem proving, compilation; editing; and various Normally, arguments to functions are evaluated before the function itself (that is, Idris uses eager evaluation). However, this is not always the best approach. Consider the following function: ifThenElse : Idris provides a Lazy data type, which allows evaluation to be suspended: data Lazy : Type -> Type where Delay : (val : a) -> Lazy a Force : Lazy a -> a A value of type Lazy a is unevaluated0 码力 | 182 页 | 1.04 MB | 2 年前3
The Idris Tutorial Version 0.99.2http://www.idris-lang.org/ Type :? for help Idris> This gives a ghci style interface which allows evaluation of, as well as type checking of, expressions; theorem proving, compilation; editing; and various Normally, arguments to functions are evaluated before the function itself (that is, Idris uses eager evaluation). However, this is not always the best approach. Consider the following function: ifThenElse : Idris provides a Lazy data type, which allows evaluation to be suspended: data Lazy : Type -> Type where Delay : (val : a) -> Lazy a Force : Lazy a -> a A value of type Lazy a is unevaluated0 码力 | 224 页 | 1.22 MB | 2 年前3
The Idris Tutorial Version 2.3.0org/ /___/\__,_/_/ /_/____/ Type :? for help Idris> This gives a ghci style interface which allows evaluation of, as well as type checking of, expressions; theorem proving, compilation; editing; and various this, Idris provides a Lazy data type, which allows evaluation to be suspended: data Lazy : Type -> Type where Delay : (val : a) -> Lazy a Force : Lazy a -> a A value of type Lazy a is unevaluated until until it is forced by Force. The Idris type checker knows about the Lazy type, and inserts conversions where necessary between Lazy a and a, and vice versa. We can therefore write ifThenElse as follows, without0 码力 | 228 页 | 1.23 MB | 2 年前3
The Idris Tutorial Version 1.0http://www.idris-lang.org/ Type :? for help Idris> This gives a ghci style interface which allows evaluation of, as well as type checking of, expressions; theorem proving, compilation; editing; and various Normally, arguments to functions are evaluated before the function itself (that is, Idris uses eager evaluation). However, this is not always the best approach. Consider the following function: ifThenElse : Idris provides a Lazy data type, which allows evaluation to be suspended: data Lazy : Type -> Type where Delay : (val : a) -> Lazy a Force : Lazy a -> a A value of type Lazy a is unevaluated0 码力 | 223 页 | 1.21 MB | 2 年前3
The Idris Tutorial Version 1.0.1http://www.idris-lang.org/ Type :? for help Idris> This gives a ghci style interface which allows evaluation of, as well as type checking of, expressions; theorem proving, compilation; editing; and various Normally, arguments to functions are evaluated before the function itself (that is, Idris uses eager evaluation). However, this is not always the best approach. Consider the following function: ifThenElse : Idris provides a Lazy data type, which allows evaluation to be suspended: data Lazy : Type -> Type where Delay : (val : a) -> Lazy a Force : Lazy a -> a A value of type Lazy a is unevaluated0 码力 | 223 页 | 1.21 MB | 2 年前3
The Idris Tutorial Version 1.1.0http://www.idris-lang.org/ Type :? for help Idris> This gives a ghci style interface which allows evaluation of, as well as type checking of, expressions; theorem proving, compilation; editing; and various Normally, arguments to functions are evaluated before the function itself (that is, Idris uses eager evaluation). However, this is not always the best approach. Consider the following function: ifThenElse : Idris provides a Lazy data type, which allows evaluation to be suspended: data Lazy : Type -> Type where Delay : (val : a) -> Lazy a Force : Lazy a -> a A value of type Lazy a is unevaluated0 码力 | 223 页 | 1.21 MB | 2 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100
相关搜索词
Filter Viewscall-by-valuecall-by-referenceLazy EvaluationPipelinesFutures/PromisesActorsLazy ContinuationsEventualsSchedulingRangesC++composabilitylazy rangesfunctional languages函数式编程多范式语言ActionsCalculationsDataIdris依赖类型Vect类型Effects库依赖类型系统交互式环境编译器运行时系统dependent typesinteractive environmentimplicit conversionsforeign function callstype systemfunctional programmingside effects副作用处理纯函数副作用矢量类型













