This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gate takes three Observables. | |
// gateFlag$: an Observable of booleans | |
// open$: an Observable of values | |
// closed$: an Observable of values | |
var gate = function(gateFlag$, open$, closed$) { | |
... | |
}; | |
// Use Case: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var composeBack = function(nb2, nb1){ | |
return function(input, cb){ | |
nb1(input, function(err, val1) { | |
if (err) return cb(err); | |
else nb2(val1, function(err, val){ | |
if (err) return cb(err); | |
else cb(undefined, val) | |
}) | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Text.Parsec | |
import Text.Parsec.String | |
import Control.Applicative hiding (many, (<|>)) | |
data Calc = Number Float | |
| OpPlus Calc Calc | |
| OpMult Calc Calc | |
| OpSubt Calc Calc | |
| OpDivd Calc Calc | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*Main> 1 / 2 + 3 * 34 / 3 - 343 * 3 / 34 * 34 | |
-994.5 | |
*Main> intr "1 / 2 + 3 * 34 / 3 - 343 * 3 / 34 * 34" | |
Right (-994.5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Building dust-0.1.0.0... | |
Preprocessing executable 'dust' for dust-0.1.0.0... | |
Preprocessing test suite 'tests' for dust-0.1.0.0... | |
[2 of 4] Compiling Language.Parse ( src/Language/Parse.hs, dist/build/tests/tests-tmp/Language/Parse.o ) | |
src/Language/Parse.hs:17:12: | |
No instance for (Stream s m Char) arising from a use of ‘oneOf’ | |
In a stmt of a 'do' block: first <- oneOf alpha | |
In the expression: | |
do { first <- oneOf alpha; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- + Errors (1) | |
`-- tutorial.idr line 24 col 20: | |
When elaborating right hand side of vectormanip.reverse, reverseAcc: | |
Can't unify | |
Vect (m + S n) a | |
with | |
Vect (S (plus m n)) a | |
Specifically: | |
Can't unify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> var clone = _.partial(_.extend, {}) | |
undefined | |
> clone({ x: 3, y: 3 }) | |
Object { x: 3, y: 3 } | |
> clone({ x: 3 }) | |
Object { x: 3, y: 3 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- proving that these are equivalent | |
sPlusAssoc : (m, n: Nat) -> S (m + n) = plus m (S n) | |
sPlusAssoc Z n = refl | |
sPlusAssoc (S m) n = rewrite sPlusAssoc m n in refl | |
-- want to use the proof here | |
total concat : Vect n a -> Vect m a -> Vect (m + n) a | |
concat (x :: xs) ys = x :: (concat xs ys) | |
concat Nil ys = ys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sPlusAssoc : (m, n: Nat) -> S (m + n) = plus m (S n) | |
sPlusAssoc Z n = refl | |
sPlusAssoc (S m) n = rewrite sPlusAssoc m n in refl | |
total concat : Vect n a | |
-> Vect m a | |
-> Vect (m + n) a | |
concat {a=a} {m=m} {n=n} (x :: xs) ys = replace {P = \k => Vect k a} (sPlusAssoc m n) (x :: concat xs ys) | |
concat Nil ys = replace sPlusAssoc $ ys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sPlusAssoc : (m, n: Nat) -> S (m + n) = plus m (S n) | |
sPlusAssoc Z n = refl | |
sPlusAssoc (S m) n = rewrite sPlusAssoc m n in refl | |
total concat : Vect n a | |
-> Vect m a | |
-> replace {P = \k => Vect k a} (sPlusAssoc m n) (Vect (m + n) a) | |
concat (x :: xs) ys = x :: (concat xs ys) | |
concat nil ys = ys |
NewerOlder