Skip to content

Conversation

@YAXINLEI
Copy link
Contributor

Screen Shot 2022-10-13 at 5 40 52 PM

Screen Shot 2022-10-13 at 5 40 17 PM

Passed all tests by running ./vendor/bin/hacktest tests/:
Summary: 5102 test(s), 5102 passed, 0 failed, 0 skipped, 0 error(s).

@Atry
Copy link
Contributor

Atry commented Oct 14, 2022

Would you like to replace print_r with an HSL function?

@YAXINLEI
Copy link
Contributor Author

YAXINLEI commented Oct 16, 2022

Would you like to replace print_r with an HSL function?

Hey Atry, thanks a lot. I'd love to, but I wasn't able to find an appropriate HSL function for printing dictionaries. Echo also doesn't work. Would it be possible to help me with this. Many many thanks!

@Atry
Copy link
Contributor

Atry commented Oct 16, 2022 via email

@YAXINLEI
Copy link
Contributor Author

Thank you so much for your help! Would the following be the right way to use it as IO\request_output also doesn't have too many documentations.

$values = vec[1, 2, 3, 4];
$dict = Dict\from_values($values, $x ==> $x + 1);
IO\request_output($dict);

I was trying to learn from previous examples and I found both Dict.select_keys and Dict.groupby were using print_r in the existing documentation: https://github.com/hhvm/user-documentation/blob/main/api-examples/function.HH.Lib.Dict.select_keys.md

@YAXINLEI
Copy link
Contributor Author

https://docs.hhvm.com/hsl/reference/function/HH.Lib.IO.request_output/ Yaxin Lei @.***>于2022年10月15日 周六下午9:37写道:

Would you like to replace print_r with an HSL function? Hey Astry, thanks a lot. I'd love to, but I wasn't able to find an appropriate HSL function for printing dictionaries. Echo also doesn't work. Would it be possible to help me with this. Many many thanks! — Reply to this email directly, view it on GitHub <#1300 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAES3OVKTIRVW4JIGI3WHJDWDOA65ANCNFSM6AAAAAAREY2Z3A . You are receiving this because you commented

Screen Shot 2022-10-16 at 1 05 55 AM

.Message ID: ***@***.***>

All tests passed locally, and the webpage also looks fine.

https://docs.hhvm.com/hsl/reference/function/HH.Lib.IO.request_output/ Yaxin Lei @.>于2022年10月15日 周六下午9:37写道:

Would you like to replace print_r with an HSL function? Hey Astry, thanks a lot. I'd love to, but I wasn't able to find an appropriate HSL function for printing dictionaries. Echo also doesn't work. Would it be possible to help me with this. Many many thanks! — Reply to this email directly, view it on GitHub <#1300 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAES3OVKTIRVW4JIGI3WHJDWDOA65ANCNFSM6AAAAAAREY2Z3A . You are receiving this because you commented.Message ID: @.
>

All local tests and builds looks fine.

https://docs.hhvm.com/hsl/reference/function/HH.Lib.IO.request_output/ Yaxin Lei @.>于2022年10月15日 周六下午9:37写道:

Would you like to replace print_r with an HSL function? Hey Astry, thanks a lot. I'd love to, but I wasn't able to find an appropriate HSL function for printing dictionaries. Echo also doesn't work. Would it be possible to help me with this. Many many thanks! — Reply to this email directly, view it on GitHub <#1300 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAES3OVKTIRVW4JIGI3WHJDWDOA65ANCNFSM6AAAAAAREY2Z3A . You are receiving this because you commented.Message ID: @.
>

When I switched to request_output, and ran the following in the vscode debugger, nothing was given as output. And when I ran build, and looked at the website in through the server, it looked like the below. It would be awesome if you can provide some help, many thanks!
Screen Shot 2022-10-16 at 1 11 20 AM
Screen Shot 2022-10-16 at 1 15 06 AM

@Atry
Copy link
Contributor

Atry commented Oct 17, 2022

See https://docs.hhvm.com/hack/getting-started/input-and-output for basic usage of request_output.

@YAXINLEI YAXINLEI closed this Oct 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants