URL | type | author (twitter) | depends on | note |
---|---|---|---|---|
trampoline | package | @ecologician | coro, fastmap, rlang | |
rcompilertools (tweet post) | package | @dirk_sch | compiler, utils, tibble | byte compiler |
tailr |
- This is forked and summarized from https://github.com/TobCap/R/blob/774e60bff9805b37fd791ca40cc1b9d435c8dd19/functional_programming.r#L477-L516
- Before starting, execute bottom part of self-build functions
http://en.wikipedia.org/wiki/Fixed-point_combinator
compare below this R's expression with the Y combinator definition written in wikipedia!
This file contains 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
# Original is https://gist.github.com/msakai/e39c25930b661e8175759cc15175d952 | |
# Forked at 2020-01-09 | |
# Attempt to mimick following GADT (Generalized algebraic data type) in Python: | |
# | |
# data Expr a where | |
# Const :: a -> Expr a | |
# Add :: Expr Int -> Expr Int -> Expr Int | |
# Eq :: Expr Int -> Expr Int -> Expr Bool | |
# IfThenElse :: Expr Bool -> Expr a -> Expr a -> Expr a |
This file contains 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 asyncio | |
from time import time | |
async def slow_a(): | |
print("a start") | |
await asyncio.sleep(2.5) | |
print("a end") | |
async def slow_b(): | |
print("b start") |
This file contains 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
library(tidyverse) | |
A <- data.frame(x = 1:3, y = letters[1:3], stringsAsFactors = FALSE) | |
shape <- matrix(1, 2, 3) | |
rep_df <- function(df_, shape) { | |
df_ %>% | |
list() %>% | |
matrix %>% | |
kronecker(shape, FUN = rep.int) %>% |
This file contains 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
# Copyright(c) 2018 @tobakucptlsm | |
# Released under the MIT license | |
# http://opensource.org/licenses/mit-license.php | |
Gm911|Em911|Fm79/Bb|=| | |
Gm911|Em911|EbM7913|=| | |
Gm911======Em911|=| | |
Fm7911|====_Gbm7911_Gm911| | |
=======Em911|=======EbM7913| | |
=|=| |
Sys.setenv(LANG="C") # for english error message on Windows
library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 3.4.4
#> Warning: package 'tibble' was built under R version 3.4.4
#> Warning: package 'tidyr' was built under R version 3.4.4
#sessionInfo()
#with(R.version, print(c(platform, version.string)))
This file contains 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
MulLayer <- function(){ | |
x_ <- NA | |
y_ <- NA | |
forward <- function(x, y){ | |
x_ <<- x | |
y_ <<- y | |
x * y | |
} | |
This file contains 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
$ python --version | |
Python 3.6.0 :: Anaconda 4.3.1 (x86_64) | |
$ python -c "import pandas as pd; print(pd.__version__)" | |
0.19.2 | |
$ python | |
Python 3.6.0 |Anaconda 4.3.1 (x86_64)| (default, Dec 23 2016, 13:19:00) | |
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> exam1(False) | |
rise_error=False |
NewerOlder