我想将resolve_on应用于列表c1中的每个元素,比如
for(Char c:c1){
resolve_on c c1 c2;}
Run Code Online (Sandbox Code Playgroud)
那么我怎样才能使用map函数呢?
resolvents :: [Char] -> [Char] -> [[Char]]
resolvents c1 c2 = map (//what should I do) c1
resolve_on :: Char -> [Char] -> [Char] -> [Char]
resolve_on c c1 c2
Run Code Online (Sandbox Code Playgroud) if(robots[0] != null && !robots[0].isStrong()) {
if(robots[1] != null &&!robots[1].isStrong()) {
if(robots[2] != null &&!robots[2].isStrong()) {
//do something
}
}
}
Run Code Online (Sandbox Code Playgroud)
我想检查一下所有的机器人是否都不坚固,如果它们都不坚固,那么就做点什么吧.想象一下,我有10个机器人,如果有条件我是否必须写10个?