Cleaning up code - help me - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Cleaning up code - help me (/thread-5338.html) |
Cleaning up code - help me - chromos - 12-15-2015 05:57 AM Hi, I have static INPUT code, which looks like this: Code: EXPORT testinput() But number of fields is dependent on previous user's input, so I wrote this: Code: Loop; Please, is there other way how to make dynamic input than this almost unreadable code? [attachment=2958] RE: Cleaning up code - help me - cyrille de brébisson - 12-16-2015 07:44 AM Hello, For something like this, the code will be somewhat hard to read. Even the mighty MAKELIST can not help you here as you are trying to generate 2 elements per loop. I did try to simplify things using lists, but even this fails because you need to do something like: List(0):= { L3(Varaible), ....} with Variable being evaluated but L3(...) being NOT evaluated! I guess if PPL had an apply function, it could be build, but even that would not be very obvious/readable. Cyrille RE: Cleaning up code - help me - Didier Lachieze - 12-16-2015 05:20 PM Here is what I've been able to achieve using MAKELIST, working but quite ugly: Code: EXPORT testinput2() RE: Cleaning up code - help me - chromos - 12-17-2015 06:25 AM Thank you, Cyrille and Didier, for your input. It seems I have personal assistants now. Sorry if my questions are dumb so you waste your precious time on them. :-) RE: Cleaning up code - help me - cyrille de brébisson - 12-17-2015 07:23 AM Hello, No, not dumb, they are interesting and show what people want and manage to achieve with PPL. Have fun! Cyrille |