At Sat, 3 Oct 2009 15:27:57 -0400, Doug Williams wrote:
Do you think you can sneak in unsafe-fx-abs and unsafe-fl-abs?
Added in 4.2.2.4 (which is the most recent nightly build).
_
For list-related administrative tasks:
At Sat, 3 Oct 2009 16:54:26 -0400, Doug Williams wrote:
One more thing. Is there a one argument unsafe-fx- and unsafe-fl- to negate
a fixnum or float? [I suppose the same question would apply to
division/inversion, although I don't use it as much.] Obviously, I can use
(unsafe-fl- 0.0 x) for
At Sat, 3 Oct 2009 08:34:03 -0600, Matthew Flatt wrote:
(while the contract on the checked version ensures that the unsafe
operations will not cause a crash).
Not true. Sam points out that a vector (or other sequence) can be
mutable, so checking elements at the beginning does not make
At Sun, 4 Oct 2009 14:46:48 -0400, Doug Williams wrote:
When you use mutable data structures, you live with the choice. For the
statistics routines, I use exact-inexact inside the loop at the point where
I use the value, so I'm not worried about it. Off the top of my head, the
only problem I
I added real-float in the math functions in the science collection that
I'll call.
;;; (real-float x) - inexact-real?
;;; x : real?
;;; Returns an inexact real (i.e., a float) given real x. Raises an error if
x
;;; is not a real. This can be used to ensure a real value is a float, even
in
;;;
;;; (real-float x) - inexact-real?
;;; x : real?
;;; Returns an inexact real (i.e., a float) given real x. Raises an
error if x
;;; is not a real. This can be used to ensure a real value is a
float, even in
;;; unsafe code.
(define (real-float x)
(if (real? x)
(exact-inexact x)
On Oct 4, Dave Herman wrote:
I'm not sure whether the mzscheme compiler obeys the Macro Writer's
Bill of Rights in optimizing the case where exp is just a variable
reference.
- (compile '(define (fib1 n) (if (= n 1) n (+ (fib1 (- n 1)) (fib1 (- n
2))
#~binary junk
- (compile
When I was originally thinking about it, I was thinking a macro, too. I like
the real-float as an exported function for simplicity - I think most users
of the science collection would be more comfortable with it in their own
code. But I like the syntax of the following macro.
(define-syntax
Dave Herman wrote:
;;; (real-float x) - inexact-real?
;;; x : real?
;;; Returns an inexact real (i.e., a float) given real x. Raises an
error if x
;;; is not a real. This can be used to ensure a real value is a float,
even in
;;; unsafe code.
(define (real-float x)
(if (real? x)
No! 'identifier?' does not check whether a syntax object represents
a variable reference, given 1) identifier macros and 2) #%top
transformers for unbound variables. If you really, really want to
check if something is a variable reference, 'local-expand' it and
look at the result.
Oh,
No! 'identifier?' does not check whether a syntax object represents a
variable reference, given 1) identifier macros and 2) #%top transformers for
unbound variables. If you really, really want to check if something is a
variable reference, 'local-expand' it and look at the result.
Will I
About a 2x speed improvement is worth the rewrite. And, in the case of the
statistics functions, for example, most always return a float result (even
with non-float inputs) and would benefit from the rewrite. [Most that don't
always return a float, like minimum and maximum, aren't don't much
At Sat, 3 Oct 2009 12:29:01 -0400, Doug Williams wrote:
Are the basic unsafe-fl, unsafe-fx, and unsafe-vector-ref operations
included in 4.2.2?
Yes --- except for `unsafe-fx-fl', which is new in 4.2.2.3.
_
For list-related administrative tasks:
`inexact-real?'
At Sat, 3 Oct 2009 12:47:35 -0400, Doug Williams wrote:
Is there an existing contract to check for a float? For example, mean would
now be guaranteed to return a float instead of a real. It would be nice to
specify this is the contract.
On Sat, Oct 3, 2009 at 12:36 PM,
Matthew,
Do you think you can sneak in unsafe-fx-abs and unsafe-fl-abs? It's a pretty
common function - at least in the science collection - that I assume would
compile nicely. [I promise not to ask for too many of these.]
Doug
On Sat, Oct 3, 2009 at 12:56 PM, Matthew Flatt mfl...@cs.utah.edu
One more thing. Is there a one argument unsafe-fx- and unsafe-fl- to negate
a fixnum or float? [I suppose the same question would apply to
division/inversion, although I don't use it as much.] Obviously, I can use
(unsafe-fl- 0.0 x) for (unsafe-fl- x).
On Sat, Oct 3, 2009 at 4:07 PM, Matthew
16 matches
Mail list logo