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

add an example called 'drawHeart' #410

Merged
merged 2 commits into from
Dec 27, 2019
Merged

Conversation

BHMulberry
Copy link

Draw a heart-shaped pattern with a string parameter. The code is edited by VScode with the support of Anthony Fu's extension. I'm a beginner of both wenyan-lang and js, feel free to improve my code. I would be happy if my first pr was adopted, lol

Draw a heart-shaped pattern with a string parameter.
@LingDong-
Copy link
Member

Hi @BHMulberry,

Thank you so much for contributing the example! A couple of things:

  • Could you please use the stdlib for sqrt and abs instead of copying from the toy examples? stdlib implementations are more sophisticated and we would like to promote them :) The syntax is
吾嘗觀「「算經」」之書。方悟「絕對」「平方根」之義。
  • Small thing: could you please rename the file to draw_heart.wy with snake case to conform with the convention of other examples.

  • Could you please change 今天天氣不錯 to something more wenyan-ish so it goes with the theme :P

If you are busy at the moment or not sure how to do something, I can merge it and make the changes myself later today.

Thank you very much!

@BHMulberry
Copy link
Author

Glad to hear from you!
I’ve made some changes already, which includes:

  • Using stdlib 算經 for abs and sqrt functions. Sorry about my careless ignorance of the lib, I didn't even consider about stdlib in wenyan-lang. You've done such a great job!

  • Change the key string from 「「今天天氣不錯」」to「「琉璃梳子撫青絲,畫心牽腸癡不癡。」」. This line came after 溫庭筠's verse 「「玲珑骰子安红豆,入骨相思知不知」」 by later generations.

  • Rename this example file with snake case.

Here's the output:
output
It seems that I can do a lot more things with wenyan-lang, and I'll keep doing that. :)

@BHMulberry
Copy link
Author

@LingDong-
Also, I've noticed that the test always failed due to the examples are importing stdlib. Why don't you add them in the examples folder or fix the paths? I'm not sure how to do that on github, but we need to pass the test :)

@LingDong- LingDong- merged commit fa36699 into wenyan-lang:master Dec 27, 2019
@LingDong-
Copy link
Member

Awesome, thanks a lot!

The tests are breaking because I recently changed the import mechanism to import platform-specific libraries (e.g. bit ops), and I think it confuses the Gtihub actions. Since @antfu set them up, I'm not sure how to fix it (yet).

@antfu , could you please help with this, thanks :) Otherwise I can investigate too.

@antfu
Copy link
Member

antfu commented Dec 28, 2019

@LingDong- Sure! Will check it out

Edit: made a PR #414

@antfu antfu mentioned this pull request Dec 28, 2019
LingDong- added a commit that referenced this pull request Jan 20, 2020
add an example called 'drawHeart'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants