Critical Software https://criticalsoftwareblog.com A blog about software development Sat, 08 Jan 2022 10:35:26 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 108870906 The InjectOne and InjectLast operators in DIVEX and Composition Language 1 (Video) https://criticalsoftwareblog.com/2022/01/08/the-injectone-and-injectlast-operators-in-divex-and-composition-language-1-video/ https://criticalsoftwareblog.com/2022/01/08/the-injectone-and-injectlast-operators-in-divex-and-composition-language-1-video/#respond Sat, 08 Jan 2022 10:35:26 +0000 https://criticalsoftwareblog.com/?p=507 I have create a video to talk about the InjectOne and InjectLast operators in DIVEX.

InjectOne can be used to fix the value of one element in an array parameter whose element type is a function by allowing us to provide a function as a value for that element. The resulting function will still contain the array parameter but it will represent the remainder of the array. InjectLast also fixes the value of one element in an array parameter whose element type is a function (by allowing us to provide a function as a value for one element) but it also removes the array parameter from the resulting function, basically closing the array parameter. Like Inject, these operators allow us to supply functions that have extra parameters compared to the function represented by the array element type. The extra parameters will be bubbled up to the resulting function.

You can try the example in the browser here: https://divex.dev/try-in-the-browser-cscompose/?sample=InjectOneInjectLast

]]>
https://criticalsoftwareblog.com/2022/01/08/the-injectone-and-injectlast-operators-in-divex-and-composition-language-1-video/feed/ 0 507
The ReplaceOne and ReplaceLast operators in DIVEX and Composition Language 1 (Video) https://criticalsoftwareblog.com/2021/12/31/the-replaceone-and-replacelast-operators-in-divex-and-composition-language-1-video/ https://criticalsoftwareblog.com/2021/12/31/the-replaceone-and-replacelast-operators-in-divex-and-composition-language-1-video/#respond Fri, 31 Dec 2021 11:19:29 +0000 https://criticalsoftwareblog.com/?p=504 I have created a video to explain (via an example) the ReplaceOne and ReplaceLast operators in DIVEX and Composition Language 1.

ReplaceOne can be used to fix the value of one element in an array parameter by allowing us to provide a function that returns a value for one element. The resulting function will still contain the array parameter but it will represent the remainder of the array. ReplaceLast also fixes the value of one element in an array parameter (by allowing us to provide a function that returns a value) but it also removes the array parameter from the resulting function, basically closing the array parameter.

You can try the example in the browser: https://divex.dev/try-in-the-browser-cscompose/?sample=ReplaceOneReplaceLast

]]>
https://criticalsoftwareblog.com/2021/12/31/the-replaceone-and-replacelast-operators-in-divex-and-composition-language-1-video/feed/ 0 504
The ApplyOne and ApplyLast operators in DIVEX and Composition Language 1 (Video) https://criticalsoftwareblog.com/2021/12/14/the-applyone-and-applylast-operators-in-divex-and-composition-language-1-video/ https://criticalsoftwareblog.com/2021/12/14/the-applyone-and-applylast-operators-in-divex-and-composition-language-1-video/#respond Tue, 14 Dec 2021 09:10:14 +0000 https://criticalsoftwareblog.com/?p=502 In this video, I demonstrate the ApplyOne and ApplyLast operators.

ApplyOne can be used to fix the value of one element in an array parameter. The resulting function will still contain the array parameter but it will represent the remainder of the array. ApplyLast also fixes the value of one element in an array parameter but it also removes the array parameter from the resulting function, basically closing the array parameter.

You can try this example in the browser here: https://divex.dev/try-in-the-browser-cscompose/?sample=ApplyOneApplyLast

]]>
https://criticalsoftwareblog.com/2021/12/14/the-applyone-and-applylast-operators-in-divex-and-composition-language-1-video/feed/ 0 502
DIVEX vs. F# partial application (Video) https://criticalsoftwareblog.com/2021/12/08/divex-vs-f-partial-application-video/ https://criticalsoftwareblog.com/2021/12/08/divex-vs-f-partial-application-video/#respond Wed, 08 Dec 2021 18:45:09 +0000 https://criticalsoftwareblog.com/?p=500 In this video I compare the partial application feature of F# with DIVEX.

In F#, you need to fix all the dependencies of low-level functions before you pass them as arguments to high level functions (using partial application). When using DIVEX, you can inject low-level functions as arguments for high-level functions without fixing all the dependencies of low-level functions. This allows us to create potentially-pure functions and compose them without injecting impure functions. We can delay the injection of impure functions to the last possible moment.

The source code is here: https://github.com/ymassad/DivexExamples/tree/main/DivexVersusFSharpPartialApplication

This example cannot be tried in the browser. To try it, you need to download the DIVEX visual studio extension from http://divex.dev

]]>
https://criticalsoftwareblog.com/2021/12/08/divex-vs-f-partial-application-video/feed/ 0 500
Dependency Injection with F# and Composition Language 1 (Video) https://criticalsoftwareblog.com/2021/12/03/dependency-injection-with-f-and-composition-language-1-video/ https://criticalsoftwareblog.com/2021/12/03/dependency-injection-with-f-and-composition-language-1-video/#respond Fri, 03 Dec 2021 08:17:54 +0000 https://criticalsoftwareblog.com/?p=498 In this video I show an example of Dependency Injection where functions and types and defined using F# and where functions are composed using Composition Language 1.

Because DIVEX allows injection of a function, say function 1, into another function, say function 2, even if function 1 has extra parameters compared to the dependency parameter defined in function 2, we can delay the injection of impure dependencies to the last possible moment.

The source code is here: https://github.com/ymassad/DivexExamples/tree/main/DependencyInjectionFSharp

The code in this example is based on code from fsharpforfunandprofit.com (see https://fsharpforfunandprofit.com/posts/dependencies-2/).

The license for the original code can be found here: https://fsharpforfunandprofit.com/about/license/

You can download the DIVEX Visual Studio extension from https://divex.dev

]]>
https://criticalsoftwareblog.com/2021/12/03/dependency-injection-with-f-and-composition-language-1-video/feed/ 0 498
The Document Translation example in DIVEX and Composition Language 1 – F# version (Video) https://criticalsoftwareblog.com/2021/11/25/the-document-translation-example-in-divex-and-composition-language-1-f-version-video/ https://criticalsoftwareblog.com/2021/11/25/the-document-translation-example-in-divex-and-composition-language-1-f-version-video/#respond Thu, 25 Nov 2021 17:53:20 +0000 https://criticalsoftwareblog.com/?p=496 In this video, I demonstrate a larger example of DIVEX and Composition Language 1: The Document Translation example.

In this example functions and types are defined using F#. Because this example is relatively large, it better demonstrates the benefits of DIVEX and Composition Language 1.

You cannot try this example in the browser. If you want to try it you have to download the Visual Studio extension from https://divex.dev

Source code can be found here: https://github.com/ymassad/DivexExamples/tree/main/DocumentTranslationFSharp

]]>
https://criticalsoftwareblog.com/2021/11/25/the-document-translation-example-in-divex-and-composition-language-1-f-version-video/feed/ 0 496
The JoinAllInputs operator in DIVEX and Composition Language 1 (Video) https://criticalsoftwareblog.com/2021/11/24/the-joinallinputs-operator-in-divex-and-composition-language-1-video/ https://criticalsoftwareblog.com/2021/11/24/the-joinallinputs-operator-in-divex-and-composition-language-1-video/#respond Wed, 24 Nov 2021 08:10:42 +0000 https://criticalsoftwareblog.com/?p=494 I have created a video about the JoinAllInputs operator. This operator will join or merge all parameters of a function that are of the same name.

You can try this example in the browser here: https://divex.dev/try-in-the-browser-cscompose/?sample=JoinAllInputs

]]>
https://criticalsoftwareblog.com/2021/11/24/the-joinallinputs-operator-in-divex-and-composition-language-1-video/feed/ 0 494
The JoinByType operator in DIVEX and Composition Language 1 (Video) https://criticalsoftwareblog.com/2021/11/22/the-joinbytype-operator-in-divex-and-composition-language-1-video/ https://criticalsoftwareblog.com/2021/11/22/the-joinbytype-operator-in-divex-and-composition-language-1-video/#respond Mon, 22 Nov 2021 07:52:30 +0000 https://criticalsoftwareblog.com/?p=492 In this video I talk about the JoinByType operator. This operator can join or merge two or more parameters of the same type.

You can try the example in the browser here: https://divex.dev/try-in-the-browser-cscompose/?sample=JoinByType

]]>
https://criticalsoftwareblog.com/2021/11/22/the-joinbytype-operator-in-divex-and-composition-language-1-video/feed/ 0 492
The JoinByName operator in DIVEX and Composition Language 1 (Video) https://criticalsoftwareblog.com/2021/11/17/the-joinbyname-operator-in-divex-and-composition-language-1-video/ https://criticalsoftwareblog.com/2021/11/17/the-joinbyname-operator-in-divex-and-composition-language-1-video/#respond Wed, 17 Nov 2021 08:48:37 +0000 https://criticalsoftwareblog.com/?p=490 In this video I talk about the JoinByName operator in DIVEX and Composition Language 1.

The JoinByName operator allows you to join or merge two parameters of a function that have the same name. DIVEX functions are allowed to have parameters with the same name. This can happen for example if you inject two functions into a function, and these two functions have parameters with the same name.

You can try the example in the browser here: https://divex.dev/try-in-the-browser-cscompose/?sample=JoinByName

]]>
https://criticalsoftwareblog.com/2021/11/17/the-joinbyname-operator-in-divex-and-composition-language-1-video/feed/ 0 490
The Inject operator in DIVEX and Composition Language 1 (Video) https://criticalsoftwareblog.com/2021/11/13/the-inject-operator-in-divex-and-composition-language-1-video/ https://criticalsoftwareblog.com/2021/11/13/the-inject-operator-in-divex-and-composition-language-1-video/#respond Sat, 13 Nov 2021 11:17:37 +0000 https://criticalsoftwareblog.com/?p=487 In this video I talk about the Inject operator in DIVEX and Composition Language 1. The Inject operator allows you to inject a function as a value for a parameter whose type is a function. The special thing about this operator is that the injection will work even if the injected function has extra parameters. These parameters will be bubbled up to the resulting function.

You can try this example in the browser: https://divex.dev/try-in-the-browser-cscompose/?sample=Inject

]]>
https://criticalsoftwareblog.com/2021/11/13/the-inject-operator-in-divex-and-composition-language-1-video/feed/ 0 487