side-effects Questions

5

Solved

I'm trying to understand ngrx/effects. I have built a simple function that increments number by 1 with each click. But it's going in an infinite loop when clicked, not sure whats going on. I'm sure...
Timoteo asked 2/12, 2016 at 2:23

3

Solved

The offical RFC There is a example for effect function createSharedComposable(composable) { let subscribers = 0 let state, scope const dispose = () => { if (scope && --subscribers &...
Eustatius asked 27/12, 2021 at 9:35

6

IntelliJ keeps proposing me to replace my lambda expressions with method references. Is there any objective difference between both of them?
Omega asked 30/6, 2014 at 10:14

3

Solved

I am doing some exercise from the book Grokking Functional Programming, the origin code examples are written in Scala, and I want to rewrite it with Raku. In Scala's cats effect library, there is a...
Sherard asked 4/2 at 7:57

1

I did some research on side effects and as I understand it it's supposed to have the values pulled from an iterable on each call. But I'm not sure why it's not printing 1, 2 but instead <MagicMo...
Schuyler asked 3/8, 2021 at 18:45

8

Solved

The terms do appear to be defined differently, but I've always thought of one implying the other; I can't think of any case when an expression is referentially transparent but not pure, or vice-ver...

2

Solved

Consider the following code: #include <stdio.h> constexpr int f() { return printf("a side effect!\n"); } int main() { char a[f()]; printf("%zd\n", sizeof a); } I would have expected t...
Marmion asked 4/3, 2014 at 15:57

2

Solved

I have a unit test like so below: # utilities.py def get_side_effects(): def side_effect_func3(self): # Need the "self" to do some stuff at run time. return {"final":"s...
Pretermit asked 24/11, 2020 at 17:47

2

The C++20 standard says in Function Call, 7.6.1.3/8: The initialization of a parameter, including every associated value computation and side effect, is indeterminately sequenced with respect to t...

2

I wonder if there is a good reason not to send requests in the constructor of a component instead of in its componentDidMount hook? I've seen some interesting (but a bit incomplete) answers for: is...
Perineuritis asked 3/4, 2020 at 21:12

3

Solved

I've come across a rule in Sonar which says: A key difference with other intermediate Stream operations is that the Stream implementation is free to skip calls to peek() for optimization purpose. ...
Carabineer asked 24/8, 2022 at 8:50

5

Time and again I read the term effectful, but I am still unable to give a clear definition of what it means. I assume the correct context is effectful computations, but I've also seen the term effe...
Uncinate asked 28/10, 2015 at 8:55

1

Solved

I am having this issue where I have to navigate when given state gets updated after an asynchronous task gets executed. I am doing it like this: At ViewModel.kt fun executeRandomTask() { viewModel...

1

Consider the following program. #include<iostream> using namespace std; void fn(int a, int b) { cout << a; cout << b; } int main() { int a = 10; fn(a++, --a); fn(a--, ++a...
Connect asked 6/2, 2022 at 8:59

2

Solved

I have a celery retry task that I would like to test that it retries until successful. Using mock's side_effect, I can fail it for a set number of executions and then passing None, clear the side e...
Bacitracin asked 18/8, 2015 at 19:51

10

Solved

I have been trying to wrap my head around functional programming for a while now. I have looked up lambda calculus, LISP, OCaml, F# and even combinatorial logic but the main problem I have is this ...
Despondent asked 16/12, 2009 at 18:33

4

Solved

Redux reducers should be without side-effects. But what if an action should trigger the download of a file in the browser where the content is based on the state of the store? Surely this should co...
Birdsall asked 15/12, 2017 at 13:55

3

Solved

I'm currently learning about functional programming using Scala. I'm also learning about loops and how they should be avoided due to side-effects. What does this mean?
Statutable asked 23/1, 2021 at 6:48

1

This is very likely a dumb question -- I have the understanding that anything that triggers a side-effect should be handled with useEffect. I was wondering if that understanding is correct. Particu...
Insidious asked 10/8, 2020 at 1:36

2

Solved

This is more of an open Question on how to deal with functions that have type altering side effects in TypeScript. I know and strongly agree with the notion, that functions should have as few side ...

13

Solved

I feel the term rather pejorative. Hence, I am flabbergasted by the two sentences in Wikipedia: Imperative programming is known for employing side effects to make programs function. Func...

3

Solved

This is a theoretical question about minimizing side effects in bash scripting. I recently used a simple mechanism for formatting a bunch of json files, in a nested directory structure... for f i...
Marelda asked 5/4, 2015 at 13:45

5

Solved

This code (taken from Learn You A Haskell): main = do putStr "Hey, " putStr "I'm " putStrLn "Andy!" apparently desugars to main = putStr "Hey, " >>= (\_ -> putStr "I'm " >&gt...
Protestantism asked 22/11, 2011 at 11:18

7

Solved

monads are described as the haskell solution to deal with IO. I was wondering if there were other ways to deal with IO in pure functional language.
Ossify asked 28/1, 2010 at 21:22

3

Solved

Wikipedia says that: In computer science, an operation, function or expression is said to have a side effect if it modifies some state variable value(s) outside its local environment, that is to...
Irrelevant asked 2/6, 2020 at 8:57

© 2022 - 2024 — McMap. All rights reserved.