How do I point to an unary operator function from transform algorithm parameter inside a function template class member?
By : johnTheLabourer
Date : March 29 2020, 07:55 AM

Function Composition: Augmenting an existing function with additional function in Javascript
By : asubtlemind
Date : March 29 2020, 07:55 AM
this one helps. If you pass logThis() into your compose() function, you will hold a reference to it in the closure, so it will live on when you make a new logThis(). The name isn't really that important so long as you rename in an order that lets you get the reference to the old logThis() before you point the name at a new function. For example, the right side of logThis = compose(logThis, logThat) runs before the name assignment below, so you capture the function reference before reassigning the name: code :
function logThis() {console.log('this')};
function logThat() {console.log('that')};
let compose = (f1, f2) => () => {
f1()
f2()
}
logThis = compose(logThis, logThat)
logThis()

Error lvalue required as unary '&' operand, when passing function to a function
By : user2689749
Date : March 29 2020, 07:55 AM
With these it helps I am just getting familiar with how to pass function as a parameter to another function, and with pointers/C overall as well. , When you do this: code :
&foo(&x1, size)
func(foo, &x1, size);
vect(&x1, size);
vect(x1, size);

How to access root context from a composition function in Vue Composition API / Vue 3.0 + TypeScript?
By : user3335287
Date : March 29 2020, 07:55 AM
this one helps. Well, I soon found out a proper example on that same RFC site. But decided to share my examples here. The RFC site doesn't include examples in TypeScript at the moment, for clarity's sake I presume. As this new way of writing Vue 3.0 components and composition functions (as a replacement to Mixins) takes a bit of getting used to. code :
// File: @/util/notify.ts
import { SetupContext } from '@vue/compositionapi';
export function useNotify(context: SetupContext) {
const notifyError = (title: string, msg: string) => {
context.root.$bvToast.toast(msg, {
title,
variant: 'danger'
});
};
return { notifyError};
}
export default useNotify;
// Use in your functional component:
import { createComponent, SetupContext } from '@vue/compositionapi';
import { useNotify} from '@/util/notify';
export default createComponent({
name: 'MyFailingComponent',
setup(props: any, context: SetupContext) {
const { notifyError } = useNotify(context);
notifyError('Request error', 'There was an error processing your request, please try again later.');
return {};
}
});
// File: @/util/notify.ts
import { SetupContext } from '@vue/compositionapi';
export function useNotify({ context, defaultTitle = 'Hey!' }: { context: SetupContext, defaultTitle?: string }) {
const notifyError = (msg: string, title?: string) => {
context.root.$bvToast.toast(msg, {
title: title  defaultTitle,
variant: 'danger',
});
};
return {
notifyError,
};
}
export default useNotify;
// Usage like:
const { notifyError } = useNotify({ context });
// Or
const { notifyError } = useNotify({ context, defaultTitle: 'Hey there' });

How to combine binary and unary function to obtain the step function for a fold?
By : user3524967
Date : March 29 2020, 07:55 AM
this one helps. (you wanted to understand how the pointlessstyle functions work here, so here it is.) First. code :
(\a x > a*10 + digitToInt x)
=
(\a x > (+) ((*10) a) (digitToInt x))
=
(curry $ (+) . (*10) . fst <*> digitToInt . snd)
=
(curry $ uncurry (+) . ((*10) *** digitToInt))
(\a x > a*10 + digitToInt x)
=
(\a x > (+) ((*10) a) (digitToInt x))
=
(\a x > ((+) . (*10)) a . digitToInt $ x)
=
(\a > ((+) . (*10)) a . digitToInt )
=
(\a > (. digitToInt) ( ((+) . (*10)) a ) )
=
(\a > (. digitToInt) . ((+) . (*10)) $ a )
=
(. digitToInt) . (+) . (*10)
(curry $ (+) . (*10) . fst <*> digitToInt . snd) a x
= { curry f a b = f (a, b) }
((+) . (*10) . fst <*> digitToInt . snd) (a, x)
= { (f <*> g) a = f a (g a) ; (f . g) a = f (g a) }
((+) . (*10)) (fst (a, x)) (digitToInt ( snd (a, x)))
=
((+) . (*10)) a (digitToInt x )
= { (f . g) a = f (g a) ; (`c` b) a = (a `c` b) }
(+) (a*10) (digitToInt x )
= { (c) a b = (a `c` b) }
(a*10) + digitToInt x
(curry $ uncurry (+) . ((*10) *** digitToInt)) a x
= { curry f a b = f (a, b) }
(uncurry (+) . ((*10) *** digitToInt)) (a, x)
= { (f *** g) a = (f $ fst a, g $ snd a) }
uncurry (+) ( (*10) a , digitToInt x )
= { uncurry f (a, b) = f a b }
(+) ( (*10) a) (digitToInt x )
= { (`c` b) a = (a `c` b) }
(+) (a*10) (digitToInt x )
= { (c) a b = (a `c` b) }
(a*10) + digitToInt x
((. digitToInt) . (+) . (*10)) a x
= { (f . g) a = f (g a) }
((. digitToInt) . (+)) ((*10) a) x
= { (`c` b) a = (a `c` b) }
((. digitToInt) . (+)) (a*10) x
= { (f . g) a = f (g a) }
(. digitToInt) ( (+) (a*10) ) x
= { (`c` b) a = (a `c` b) }
((+) (a*10) . digitToInt) x
= { (f . g) a = f (g a) }
(+) (a*10) ( digitToInt x )
= { (c) a b = (a `c` b) }
(a*10) + digitToInt x
foldl (\a > (a*10 +) . digitToInt) ...

