
Basically it's very simple, but also very complicated. I can understand certain individual statements, but I have absolutely no idea on how to actually DO something...
Has anyone else tried this inside out language?
Code: Select all
x = 0
For i = 0 To 10
x + i
Next i
Debug x
Code: Select all
/ 0 if x = 0
f(x) = |
\ x + f(x - 1) otherwise
Code: Select all
Procedure f(x)
If x = 0
ProcedureReturn 0
Else
ProcedureReturn x + f(x - 1)
EndIf
EndProcedure
Debug f(10)
Code: Select all
f x =
if x == 0
then 0
else x + f (x - 1)
Code: Select all
g 0 = 0
g x = x + g (x - 1)
Yeah. Now get back to working on 4.20djes wrote:freak> Thank you for this great explanation
I suppose my point is more that, with implementing algorithms, its often not enough that it just works. Optimisation is a key point. In my (admittedly very limited) experience with these languages they are used at a level that makes it difficult to see what's happening under the hood so you can optimise the code. Some algorithms if not implemented properly can blow all memory away in a millisecond.freak wrote:@pdwyer:
This is not true. Functional languages can be very efficient, espechially those that
compile to native code. Of course for some algorithms their performance
is bad, but you can easily find such examples for any language.
Imho they are espechially good for implementing algorithms, because some things
can be expressed much more clearly than in other languages, so the implementation is easier to follow.
Also the closeness to the mathematical definition is a good point when it comes
to prooving that an algorithm actually works correctly.
(good luck prooving that for a C code that throws around pointers like hell...)
Oops, too much text and out of time... have to go