Re: Pointer variables possible?

Consultant (amrit@xvt.com)
Fri, 8 Apr 1994 10:24:57 -0600 (MDT)

>
> Maybe what we need are Scheme-style "boxes." They provide a form
> of "call-by-reference", like so:
>
> > (set! x (box 3))
> > (define make-it-four
> (lambda (foo)
> (set-box! foo 4)))
> > (make-it-four x)
> > (unbox x)
> 4
>
> Steve
>
You can use a list (clumsy but it works) to do the trick:

>>>x = [3]

>>>def make_it_four(foo): foo[0] = 4
>>>make_it_four(x)

>>>print x[0]
4