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 Pony version #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ This file is used to track the language used in the current implementations:
- [x] Perl
- [x] PHP
- [ ] PogoScript
- [x] Pony
- [x] Potigol
- [ ] Processing
- [x] Progress - OpenEdge
Expand Down
7 changes: 7 additions & 0 deletions pony/main.pony
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
actor Main
new create(env: Env) =>
let s = Wesley.safadeza(1, 6, 96)
let a = Wesley.angel(s)
let message = Wesley.formatMessage(s, a)
env.out.print(message)

Binary file added pony/pony
Binary file not shown.
26 changes: 26 additions & 0 deletions pony/wesley.pony
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
primitive BasicMath
fun sum(x: F32): F32 =>
var count: F32 = 1
var sumValue: F32 = 0

while count <= x do
sumValue = sumValue + count
count = count + 1
end

sumValue

primitive Wesley
fun safadeza(day: F32, month: F32, year: F32): F32 =>
let m = BasicMath.sum(month)
let y = year / 100
let d = 50 - day

m + (y * d)

fun angel(safadezaPercent: F32): F32 =>
100 - safadezaPercent

fun formatMessage(safadaoPercent: F32, angelPercent: F32): String =>
"Você é " + safadaoPercent.string() + "% safado e " + angelPercent.string() + "% anjo"