FunClosureFunClosure

Logic Formation

func makeFlowchartNodes(from notion: Notion) -> [FlowchartNode] {
    
    let organizedIdeas = organize(notion)
    let nodes: [FlowchartNode] = organizedIdeas.map{ idea in
        let logics = relationship(of: idea, with: organizedIdeas)
        let node = FlowchartNode(logics: logics)
        return node
    }
    return nodes
}

func organize(_ notion: Notion) -> [Idea] {
    // Brain works...
}

func relationship(of idea: Idea, with: otherIdeas: [Ideas]) -> [Logic] {
    var logics: [Logic] = []
    for otherIdea in otherIdeas {
        if idea.isRelated(with: otherIdea) {
            let logic = Logic(from: idea, to: otherIdea)
            logics.append(logic)
        }
    }
    return logics
}

Tagged with: