question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Newbie composition question

See original GitHub issue

Apologies if this is not the place to ask this question but maybe other new people want help as well.

How do I compose a function multiple curried parameters to one with a single curried parameter?

So given a list of objects current. How would I make this work?

 var n = R.compose(
   R.adjust(update, R.__, R.__),
   R.findIndex(R.propEq("id", id))
  );

n(current);

At the moment n(current) just results in another curried function.

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
davidchamberscommented, Feb 23, 2017

This may be a good starting point, @hmgibson23:

R.map(R.when(R.propEq('id', 1),
             R.assoc('key', 'an update')),
      [{id: 1, key: 'value'}, {id: 200, key: 'value'}])

You could parameterize 1 and 'an update' quite simply. I think you’re better off avoiding compose/pipe in this case, because the arguments you wish to parameterize are quite nested.

0reactions
hmgibson23commented, Feb 23, 2017

Okay thanks for your help. I’ll look into that.

I’ll also close the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[newbie questions] several on party composition, alignment, re ...
Basically I'm trying to figure if I need to lock in a single party composition early to avoid wasting resources on companions I...
Read more >
Divinity: Original Sin 2 - party composition - Steam Community
We're planning on using a full roster (so no lone wolves) and I was wondering who we could use as a tank and...
Read more >
Composition Checklist for Beginners
This list of 15 things will help you create better images - use this composition checklist of things to run through before you...
Read more >
A Beginner's Guide to Basic Photo Composition
Learn everything you need to get started with basic photo composition, with these well organised tutorials, selected for beginners looking to improve.
Read more >
OOP Concepts for Beginners: What is Composition? - Stackify
Composition is one of the fundamental concepts in object-oriented programming. It describes a class that references one or more objects of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found