Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive Expressions: fill in obvious gaps with additional pre-built functions #4014

Closed
Stevenic opened this issue May 23, 2020 · 10 comments
Closed
Assignees
Labels
R10 Release 10 - August 17th, 2020
Milestone

Comments

@Stevenic
Copy link
Contributor

Issue

This issue is to track additional functions we want to add to Adaptive Expressions for R10. Just reply with a proposed function.

[dcr]

@Stevenic
Copy link
Contributor Author

Stevenic commented May 23, 2020

indexOf

This function should let you lookup the index of an item matching a filter.

@Stevenic
Copy link
Contributor Author

merge

This function would let you merge one or more JSON objects into a single JSON object.

@vishwacsena vishwacsena transferred this issue from microsoft/botframework-sdk Jun 1, 2020
@gabog gabog added R10 Release 10 - August 17th, 2020 parity with JS labels Jun 2, 2020
@Danieladu
Copy link
Collaborator

It would be better if a sample is attached for each function

@KayMKM
Copy link
Contributor

KayMKM commented Jun 4, 2020

A function that can combine two list.
E.g. a=[1, 2, 3], b=[2, 3, 4], combine(a, b)=[1, 2, 3, 2, 3, 4]

@boydc2014
Copy link
Contributor

@Danieladu can you propose the function signature for those functions and let us review

@Danieladu
Copy link
Collaborator

indexOf/lastIndexOf

Expression already contains these two functions, but just with the default equals condition.
So, should we change the original function to make it 'lambda'? The function may like:
indexOf([1, 2, 3], x, x > 2)
Change the original function maybe a breaking change?

merge

merge(json1, json2), should we add some more parameters? like ignore case

Combine two list

Now expression has function union to combine two lists and remove the duplicated items.
So, the function's name is the biggest issue, combine? addrange ? concatList? (concat is exist)

@vishwacsena
Copy link
Contributor

index/indexof - need to verify with @Stevenic if what we have is enough
merge(json, json) makes sense.
concat(list1, list2) makes sense.

@boydc2014
Copy link
Contributor

boydc2014 commented Jul 8, 2020

@Stevenic can you confirm what we have now index\indexof is good enough?

@Danieladu can you list what's the way to do index based on a filter condition like x > 2 today, or it's not supported?

@Danieladu
Copy link
Collaborator

Danieladu commented Jul 8, 2020

Here is the workaround:
where(indicesAndValues(user_list), x, x.value > 2)[0].index

In the next stage, we may consider extend some functions to support the filter scenario with lambda expression. like first, last, count, indexOf, lastIndexOf .etc.

Examples:

first(list, x, x > 2)
last(list, x, x>2)
count(list, x, x>2)
indexOf(list, x, x > 2)
lastIndexOf(list, x, x > 2)

But before these features are completed, users can also achieve these results through the solution by other builtin functions or customize functions.

@boydc2014
Copy link
Contributor

@Stevenic we are closing this now, see above the resolved issue, if you continue to have gaps, let's track them via new issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R10 Release 10 - August 17th, 2020
Projects
None yet
Development

No branches or pull requests

7 participants