* Home
* FAQ
* Tools
+ Games
+ GNU bc
+ Interesting
+ Stuff
+ Links
|
|
This page will showcase any of coding exercises I set myself just to see
if I can still come up with a decent algorithm.
Currently, there's only NFor and a Binary Search here. This might
change if I get a concept in my head that screams to be coded.
NFor - (Say: "en-for") - An attempt at a new programming concept
- nfor.e library - beta - contains test code
Have you ever created an n-dimensional sequence, then had to write
n for-loops to process it? Then you realise you need to add an extra
dimension to the elements, so you have to add another for-loop to the code,
etc. etc.
nfor.e attempts to address the issue by creating all the for-loops at the same
time, and closing all the loops at the same time. It isn't perfect; There's no
way to do initialisations before inner loops start or after they end. To offset
this, it's possible to nest nfor loops. The test code at the end of the
file demonstrates this. This means that at nested-for levels where no
initialisations are required, they can be bundled into an nfor, initialisations
for inner loops can be done, then further fors and nfors can be done within the
outer loop.
As per usual there's no documentation yet, and some of the code hasn't been
tested properly. However, the test code at the end is a fully functional example
of how to use the code - run it a couple of times with and without the trace(1)
to see what's going on.
Binary Search - In-order insertion of tagged strings into a data structure
|