-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.ds
35 lines (33 loc) · 930 Bytes
/
makefile.ds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
fn <scope> ask_user
question = set ${1}
print -bgc red -c black " ► "
print -bgc black -c white " ${question} "
print -s bold "(y/N)"
echo " "
reply = read
return ${reply}
end
# Function to generate the power set of an array
fn <scope> generate_power_set
input = set ${1}
len = arrlen ${input}
indicies = range 0 ${len}
sets = array
power_set = array
for i in ${indicies}
elem = array_get ${input} ${i}
elem = array ${elem}
new_power_set = array
for ps_elem in ${power_set}
array_push ${new_power_set} ${ps_elem}
end
array_push ${new_power_set} ${elem}
for ps_elem in ${power_set}
new_elem = array_concat ${ps_elem} ${elem}
array_push ${new_power_set} ${new_elem}
end
release ${power_set}
power_set = set ${new_power_set}
end
return ${power_set}
end