Giter VIP home page Giter VIP logo

Comments (13)

elliottc avatar elliottc commented on August 11, 2024 1

Not sure if this deserves its own issue but I found myself wanting a way to merge maps as well. I've used Python's dictionary unions like this before.

from expr.

antonmedv avatar antonmedv commented on August 11, 2024 1

Added!

from expr.

antonmedv avatar antonmedv commented on August 11, 2024

Right now Expr doesn't have a built-in concat function.

But it can be easily added via expr.Function

from expr.

lukas-vollmer avatar lukas-vollmer commented on August 11, 2024

Sure @antonmedv, but I think its commonly enough to add it here as well

from expr.

antonmedv avatar antonmedv commented on August 11, 2024

What should we add? append() or concat()? :)

from expr.

lukas-vollmer avatar lukas-vollmer commented on August 11, 2024

I think concat() would make more sense here, since append would only add the array as a new entry:
concat:

array1 = [1, 2, 3]
array2 = [4, 5, 6]
array3 = concat(array1, array2) -> [1, 2, 3, 4, 5, 6]

Append would be:

array1 = [1, 2, 3]
array2 = [4, 5, 6]
array3 = append(array1, array2) -> [1, 2, 3, [4, 5, 6]]

from expr.

lukas-vollmer avatar lukas-vollmer commented on August 11, 2024

Hmm just checked it for go. It seems different here xD

package main

import (
    "fmt"
)

func main() {
    slice1 := []int{1, 2, 3}
    slice2 := []int{4, 5, 6}

    // Concatenating slice1 and slice2
    concatenatedSlice := append(slice1, slice2...)

    fmt.Println(concatenatedSlice) // Output: [1 2 3 4 5 6]
}

from expr.

lukas-vollmer avatar lukas-vollmer commented on August 11, 2024

Ok append it is :) I still think that concat is the better function name, but could be bias.

from expr.

antonmedv avatar antonmedv commented on August 11, 2024

I like concat()?

from expr.

lukas-vollmer avatar lukas-vollmer commented on August 11, 2024

I also think concat() is the better wording for that.

from expr.

annamedv avatar annamedv commented on August 11, 2024

I love JS, so will vote for concat(). And one element can be wrapped in array.

from expr.

kuadrosx avatar kuadrosx commented on August 11, 2024

I think with slices.Concat added in Golang 1.22(to merge to slices), the name should be concat

from expr.

antonmedv avatar antonmedv commented on August 11, 2024

So it will be concat

from expr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.