Thoughts on the possibility of cyclic specification combination

clipboard.png

size has 1 parameter
number of holes and distance between holes have 3 parameters
J value has 2 parameters
et value has 1 parameter
center hole has 2 parameters

there are 12 possible combinations. Thank you.

Mar.11,2021

try the following code

function cross(inputs){
    let result = inputs[0].map(item => [item]);

    for(let cross_item of inputs.slice(1)){
        result = cross_item.reduce((acc,target)=>(result.forEach(result_item=>acc.push([...result_item,target])),acc),[]);
    }
    return result;
}

console.log(cross([['n','o','t'], ['i', 'n'], ['a'],['(',')']]));

-it could be a little shorter.-

function cross(inputs){
    return inputs.reduce((result,cross_item)=> cross_item.reduce((acc, target) => (result.forEach(result_item => acc.push([...result_item, target])), acc), []))
}

put it into a two-dimensional array and combine it recursively

let arr=[
    [11,12],
    [21,22,23],
    [31],
    [41,42]
]
f(arr,0,[])
function f(arr,k,temp){
    if(k==arr.length){
        console.log(JSON.stringify(temp))
        return
    }
    for(let i=0;i<arr[k].length;iPP){
        temp[k]=arr[k][i]
        f(arr,k+1,temp)
    }
}

Cartesian product learn about

generate all possible combinations of attributes

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb0d25-2303.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb0d25-2303.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?