使用R.view
dinamicly ...我怎样才能获得动态视图从动态镜头
const robotsNames = [ 'da Vinci Surgical System', 'KITT', 'The Tachikomas', 'Toyota violin-playing robot',
'GERTY', 'Mega Man', 'Rock ‘Em Sock ‘Em Robots', 'Doraemon', 'Awesom-O', 'HK-47', 'ED-209', 'Beer-Fetching Robot',
'Bishop', 'The Energizer Bunny', 'Clank', 'Daft Punk', 'Johnny 5', 'The Robot', 'Roboto', 'Marvin the Paranoid Android',
'Lego Mindstorms NXT', 'Robbie', 'Astro Boy', 'The Iron Giant', 'Optimus Prime', 'Roomba', 'DJ Roomba', 'Cindi Mayweather',
'Rosie', 'Crow T. Robot/Tom Servo', 'K-9', 'The Terminator', 'The Maschinenmensch, aka Maria', 'ASIMO', 'GLaDOS', 'HAL 9000',
'The Final Five', 'Sojourner', 'Data', 'R2D2', 'Bender Bending Rodriguez', 'Wall-E' ];
const getRandomInt = R.curry((min, max) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
})
const getRandomFromZero = getRandomInt(0);
const lensRandomRobot = R.pipe(R.length, getRandomFromZero, R.lensIndex);
// NOT WORK...
const randomRobot = R.pipe(lensRandomRobot, R.view);
const robot = randomRobot(robotsNames);
// THIS WORKS ..
// const robot = R.view(lensRandomRobot(robotsNames))(robotsNames) // I dont want to pass the values twiice
console.log(robot);
<script src="//cdnjs.cloudflare.com/ajax/libs/ramda/0.23.0/ramda.min.js"></script>