Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,3 @@
for each element in the set:
for each subset constructed so far:
new subset = (subset + element)

View file

@ -0,0 +1,14 @@
powerset <- function(set){
ps <- list()
ps[[1]] <- numeric() #Start with the empty set.
for(element in set){ #For each element in the set, take all subsets
temp <- vector(mode="list",length=length(ps)) #currently in "ps" and create new subsets (in "temp")
for(subset in 1:length(ps)){ #by adding "element" to each of them.
temp[[subset]] = c(ps[[subset]],element)
}
ps <- c(ps,temp) #Add the additional subsets ("temp") to "ps".
}
ps
}
powerset(1:4)

View file

@ -0,0 +1 @@
library(sets)

View file

@ -0,0 +1,3 @@
v <- (1:3)^2
sv <- as.set(v)
2^sv

View file

@ -0,0 +1,3 @@
l <- list(a=1, b="qwerty", c=list(d=TRUE, e=1:3))
sl <- as.set(l)
2^sl