Problem with postlude in 'elvish' language

What happens

I need to pass input data via pipe, but it doesn’t work

What do you understand or find about that problem

Since I can’t find a way to ask for user input, the only way I’ve found to pass data is through args, and it doesn’t get input data if I use pipe

You make any workaround? What did you do?

I’ve tried to find a way to ask for input data, but I haven’t found anything. I’m using a different way to get input data, but my MR can’t be approved if I use it.


This is how I’m currently passing the data (as args)

elvish test.elv $(cat DATA.lst)

and it should be like

cat DATA.lst | elvish test.elv

I need help with

I need a way to get data via pipe for my postlude to be approved. Also, if I can’t find another way to get data it will be a problem if a challenge requires a multi line input, because args takes all lines as a consecutive only one

Hi!, this simple script allows you to get a string of each line in your DATA.lst file using cat DATA.lst | elvish test.elv , now you only need to find a way to work with that strings

fn prints [data]{
    put $data

each [x]{ prints $x }

And remember to avoid mutation on functional programming

what operating system do you use?

I recommend that you use Kali SO, it can be in a virtual machine, In Kali you can run without problems:

elvish test.elv $(cat DATA.lst)

And you can base yourself with this script

main = [args]{
echo $args

$main $args

1 Like

Hi @absolute-contract , data can’t be passed with
elvish test.elv $(cat DATA.lst)
it must be passed via pipe
cat DATA.lst | elvish test.elv
also, if you read data using $args then you can’t differentiate a line from another, because $args takes all the input as a single line, and if the challenge has a multi line input or cases with different sizes then it would be difficult to identify each line. Actually, ‘uneasy-ruler’ solution works very well and I can adapt it to what I need. Thanks

1 Like