japt icon indicating copy to clipboard operation
japt copied to clipboard

Default inputs

Open PeterShaggyNoble opened this issue 7 years ago • 2 comments

As it stands U-Z all default to 0. Would it be possible to change those defaults to something else, with each parameter being different?

This would give room for 6 new variables/shortcuts, presuming, of course that no arguments are passed through them.

I haven't given much thought to what the new defaults could be yet but one possibility might be an empty array of length U, equivalent to [...Array(U)] in ES6. Unless I've missed a trick, which could well be the case after less than 24 hours working with it, there's currently no shortcut for that in Japt.

PeterShaggyNoble avatar May 19 '17 07:05 PeterShaggyNoble

Yes, good idea. I've been considering changing the default value of V to 1 to help with recursive programs (fibonacci, for example), not sure what the others should be though. If you need to, you can get an all-zero array of the same length as U with .

ETHproductions avatar May 20 '17 12:05 ETHproductions

Thanks, @ETHproductions. I've since figured out a few other ways of generating an array of length U - as [...Array(U)] generates an array of empty elements, usually in order to map over it, avoiding the need for any sort of loop, the contents of the array don't much matter.

Back to the issue at hand, I still haven't put much more thought into what the new default parameters could be, but I'd suggest that they be assigned to the input variables in order of least to most useful, thereby reducing the risk of overwriting the most useful ones.

PeterShaggyNoble avatar May 24 '17 17:05 PeterShaggyNoble