Changeset 17924 in project
 Timestamp:
 04/26/10 13:11:35 (9 years ago)
 Location:
 release/4/unitconv/trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

release/4/unitconv/trunk/unitconveggdoc.scm
r15185 r17924 9 9 10 10 (history 11 (version "2.0" "Added unit arithmetic (withunits)") 11 12 (version "1.8" "Exporting all prefixed units; added info on information units [Joshua Griffith]") 12 13 (version "1.7" "Exporting the Rate quantity") … … 21 22 (requires) 22 23 23 (usage "(requireextension unitconv)" 24 "(include \"unitdefinitions\")") 25 26 (download "unitconv.egg") 24 (usage "(requireextension unitconv)") 27 25 28 26 (documentation … … 292 290 (defineunit bytespersecond Rate (/ byte second) Bps) 293 291 )) 292 293 (subsection "Arithmetic Operations with Units" 294 295 296 (p "The " (tt "withunits") " library contains procedures for arithmetic operations " 297 "on quantities with units. A quantity with unit information is created by procedure " 298 (code "valwithunits") ": " 299 300 (pre #<<EOF 301 (use unitconv withunits) 302 (valwithunits 10 m) > #(10 #(unit meter (m meters) [Length] 1.0)) 303 EOF 304 )) 305 306 (p "The following operations are available for operations on quantities with units: " 307 308 (dl 309 (dt (tt "u:value") (dd "Returns the value of the given quantity.")) 310 (dt (tt "u:units") (dd "Returns the unit of the given quantity.")) 311 (dt (tt "u:equal?") (dd "Returns true if the units of the given quantities are equal, false otherwise.")) 312 (dt (tt "u:zero?")) 313 (dt (tt "u:=")) 314 (dt (tt "u:negate")) 315 (dt (tt "u:invert")) 316 (dt (tt "u:+ u: u:* u:/ ")) 317 (dt (tt "u:sqrt")) 318 (dt (tt "u:sin")) 319 (dt (tt "u:cos")) 320 (dt (tt "u:expt")) 321 ) 322 323 )) 294 324 ) 295 325 … … 320 350 csi> (unitconvert inch mm 12) 321 351 304.8 352 353 ;; Unit arithmetic 354 355 csi> (use withunits) 356 csi> (u:+ (valwithunits 10 m) (valwithunits 5 m)) 357 #(15 #(unit meter (m meters) [Length] 1.0)) 358 322 359 EOF 323 360 )) … … 325 362 326 363 (license 327 "Copyright 200720 09Ivan Raikov.364 "Copyright 20072010 Ivan Raikov. 328 365 329 366 This program is free software: you can redistribute it and/or modify 
release/4/unitconv/trunk/withunits.scm
r17915 r17924 129 129 (or (withoutunits? x) (withoutunits? y))) 130 130 (+ (u:value x) (u:value y))) 131 (else (error "units do not match: +" x y)))131 (else (error 'u:+ "units do not match: " x y))) 132 132 (valwithunits(+ x y) unitless ))) 133 133 … … 141 141 (or (withoutunits? x) (withoutunits? y))) 142 142 ( (u:value x) (u:value y))) 143 (else (error "units do not match: " x y)))143 (else (error 'u: "units do not match: " x y))) 144 144 (valwithunits ( x y) unitless))) 145 145 … … 161 161 (valwithunits (expt (u:value x) (u:value y)) 162 162 (unitexpt (u:units x) (u:value y))) 163 (error "exponent must be unitless: expt" x y))163 (error 'u:expt "exponent must be unitless:" x y)) 164 164 (valwithunits (expt x y) unitless))) 165 165
Note: See TracChangeset
for help on using the changeset viewer.