vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.63k stars 2.15k forks source link

unknown function: `join_lines` #14443

Closed vanceism7 closed 2 years ago

vanceism7 commented 2 years ago

V version: V 0.2.4 bc397bb.a608516 OS: linux, "instantOS" (VM)

What did you do? Im trying to use join_lines (found here) to combine an array of strings into a string.

A minimal example is to start the v repl and enter the following

some_str := join_lines("hello\nworld!")

What did you expect to see? some_str to become some string value

What did you see instead? unknown function: join_lines

Other notes

I can see that the version on the module site doesn't match my current version of v. Perhaps the function was moved out of builtin into some other module? Not sure, but just wanted to report this in!

Thanks!

changrui commented 2 years ago
str_arr := ['hello', ',', 'world.']
println(str_arr.join_lines())
println(str_arr.join(''))

Output

hello
,
world.
hello,world.
vanceism7 commented 2 years ago

Oh blah! My bad. I thought join_lines was a stand-alone function similar to println. My functional programming ways are getting me "caught up". Thanks for clarifying!