Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Celsius-Fahrenheit / Fahrenheit-Celsius

 [1/4] from: norsepower:uswest at: 11-Dec-2000 20:59


I was bored and so I whipped this one up. Since it is -20F here in North Dakota, I needed something to tell my IRC pals how cold it is today. Have fun! temperature: make object! [ to-celsius!: func [ temp-F [integer!] ][ temp-C: ((temp-F - 32) / 9) * 5 ] to-fahrenheit!: func [ temp-C [integer!] ][ temp-F: ((temp-C * 9) / 5) + 32 ] ]

 [2/4] from: al::bri::xtra::co::nz at: 12-Dec-2000 18:06


These seem a little simpler: Celcius: func [Temperature [number!]][Temperature - 32 / 9 * 5] Fahrenheit: func [Temperature [number!]][Temperature * 9 / 5 + 32] Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/

 [3/4] from: ralph:abooks at: 12-Dec-2000 9:32


should not the script containing your function have a .brrrrrr extension?<g> --Ralph

 [4/4] from: norsepower:uswest at: 12-Dec-2000 7:04


Ahh... but I have a fetish for using functions called as paths of objects:
>> temperature/to-celsius! 32
== 0
>> temperature/to-fahrenheit! 100
== 212 And the "!" exclamation points are exciting! (of course they do tend to indicate you are assigning a datatype. Perhaps we should have a temperature datatype! which rounds off decimals to the nearest whole number?)