[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: algorithms



la stivn cusku di'e
> How are algorithms expressed in lojban? Of course, one could just describe
> them, but the concepts seem a little rich for the syntax of mathematical
> expression.
> It would be interesting if one could say:
>
> man=Array[mana, manb, manc]
> dog=Array[doga, dogb, dogc]
> For i taking values from one to three
>  For j taking values from one to three
>   man[i] pets dog[j]
>  End For
> End For

Well, you can do something similar:

ko'a goi lu'i le nanmu kuxipa e le nanmu kuxire e le nanmu kuxici
ko'e goi lu'i le gerku kuxipa e le gerku kuxire e le gerku kuxici
i ro da poi cmima ko'a ku'o ro de poi cmima ko'e zo'u da satre de

> or to avoid implying a specific order:

That one doesn't imply a specific order. Using {vu'i} instead of
{lu'i} would imply a specific order, although who knows what order.
(Temporal?)

> or to mean a different thing
>
> For i taking values from one to three
>  j=Random[integer on closed interval (1,3)]
>  man[i] pets dog[j]
> End For

I'm not sure when you would want to say something like that.

saying:

i ro da poi cmima ko'a ku'o su'o de poi cmima ko'e zo'u da satre de

tells you that each man pets one of the three dogs, without saying which.
But that is different from saying that each man touches one dog selected
at random. The computer language is probably used to give an order, rather
than to give information.

> I believe that handling of problems involving statements about the dogs and
> men might benefit from some algorithmic thinking. By the way, the example
> algorithmic expression was chosen for clarity of expressing the idea. There
> are some powerful operaters in J and Mathematica which would handle these
> types of expressions with elegant precision and compactness.

There is a difference in saying that each man pets a dog, and giving
an order to the computer to assign a dog to each man.

Jorge