fancylojban challenges: Difference between revisions

From Lojban
Jump to navigation Jump to search
Line 21: Line 21:
         '''return''' gcd(b, a '''mod''' b)
         '''return''' gcd(b, a '''mod''' b)


Also try a non-recursive version, but we'd probably need a new brivla for while-loop, and {tu'e...tu'u} in NU. Which brings us to...
Also try a non-recursive version, but we'd probably need a new brivla for while-loop, and {tu'e...tu'u} in NU.
 
Subproblem #1: come up with a better brivla to define than one based on the abbreviation "gcd"
 
[http://pastebin.com/F9795SdM Solution] by [[User:Spheniscine|la zipcpi]] (doesn't solve subproblem #1)


== While-loop brivla - English and Lojban definitions ==
== While-loop brivla - English and Lojban definitions ==

Revision as of 09:50, 21 July 2015

Lojban is supposed to be a logical language, so why not practice translating some common mathematical statements, or algorithms

Additional challenge: Don't use mekso with VUhU. Or use them, if you prefer the challenge of wrangling with mekso grammar...

Fermat's Last Theorem

(The statement, not the proof, of course!)

"No three positive integers a, b, and c can satisfy the equation an + bn = cn for any integer value of n greater than two."

Subproblem #1: How to explicitly make letter pronouns or ko'a-series existential, without having to assign {daxivo goi ny} e.g.?

Solution by la zipcpi (doesn't solve subproblem #1)

Euclid's Algorithm for Greatest Common Divisor

function gcd(a, b)
    if b = 0
       return a
    else
       return gcd(b, a mod b)

Also try a non-recursive version, but we'd probably need a new brivla for while-loop, and {tu'e...tu'u} in NU.

Subproblem #1: come up with a better brivla to define than one based on the abbreviation "gcd"

Solution by la zipcpi (doesn't solve subproblem #1)

While-loop brivla - English and Lojban definitions

In the vein of ifle, we might need brivla suitable for describing while-loops...

While-loop:

As long as x1 (du'u proposition) is true, x2 (action/event) repeatedly happens

Do-while-loop:

x1 (action/event) happens, then repeats as long as x2 (du'u proposition) is true.

With ko'oi / gau ko / ko gasnu lo nu turning it into a command that the agent (whether it's a computer or a person) should follow.

Informal algorithms

Instructional texts like cookbooks or game rules, that might have use for certain programming-language-like structures, but which might not need to be specified to the last detail like programming languages...