urduscript icon indicating copy to clipboard operation
urduscript copied to clipboard

Added naqsh function representing the map function

Open mzaidikhlas opened this issue 7 years ago • 7 comments

I have added the naqsh function which maps a number from one range to another naqsh(value, currentMinRange, currentMaxRange, targetMinRange, targetMaxRange)

Example:

rakho x = naqsh(5,1,10,1,100)
likho(x) // outputs 45

mzaidikhlas avatar Jul 28 '17 20:07 mzaidikhlas

can you provide little elaboration over this ? or some thing equivalent in JS, may be I am missing something here. Thanks

monis01 avatar Jul 30 '17 07:07 monis01

It's just a mathematical function, https://www.youtube.com/watch?v=nicMAoW6u1g https://stackoverflow.com/questions/345187/math-mapping-numbers https://stackoverflow.com/questions/5649803/remap-or-map-function-in-javascript

mzaidikhlas avatar Jul 30 '17 07:07 mzaidikhlas

This is great stuff. I know naksh translates perfectly but do we have a more simpler word we can use? Not necessarily a translation but conveys the meaning.

asadm avatar Jul 30 '17 08:07 asadm

Yes @asadm i agree, its a bit complicated since its a math driven function but I couldn't think of a simpler interpretation. Nevertheless, suggestions from the community would be highly appreciated so that we can change it to a simpler one.

mzaidikhlas avatar Jul 30 '17 08:07 mzaidikhlas

This would begin to change urduscript from a javascript dialect to a javascript library; is that consistent with the goals?

majidmade avatar Jul 31 '17 14:07 majidmade

I think primitive helper functions align with the goal fine. The goal is to make programming easier for Urdu speakers. Even if we go beyond what JS offers.

I would imagine inheriting some AJAX helpers too.

asadm avatar Jul 31 '17 15:07 asadm

So have we decided a name for the function?

mzaidikhlas avatar Jul 31 '17 15:07 mzaidikhlas