Created
          May 31, 2022 13:51 
        
      - 
      
- 
        Save mrpotatoes/ee20bce6b8572edc4b49da72ae34c77c to your computer and use it in GitHub Desktop. 
    my ramda confusion
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | console.clear() | |
| const R = require('ramda') | |
| const person = require('../data/lenses.arrays') | |
| // Not correct -------------------------------------------------------- | |
| const getThirdFriend_incorrect = R.pipe( | |
| R.lensProp('friends'), | |
| R.lensIndex(2) | |
| ) | |
| const result_incorrect = R.view(getThirdFriend_incorrect, person) | |
| // Actually correct --------------------------------------------------- | |
| const getThirdFriend = R.pipe( | |
| R.lensIndex(2), | |
| R.lensProp('friends'), | |
| ); | |
| const result = R.view(getThirdFriend, person); | |
| console.log('incorrect', result_incorrect) | |
| console.log('correct', result) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment