Wednesday, 14 August 2013

Vector-set! results in #

Vector-set! results in #

When I want to change a value in a vector the resulting value will become #
I have no Idea what it is or how it gets there
I have written some abstraction for handling urls. They're headed-lists
with a vector in the body.
port is the index where the port is located in the url
code in the racket file:
(define (get-port current-url)
(assert (url? current-url))
(vector-ref (body current-url)
port))
(define (set-port! current-url value)
(vector-set! (body current-url)
port
value))
code executed in IDE
(begin
(define U (url "http://services.vrt.be/atom2json" (parameter-list
"atom" "http%3A%2F%2Fderedactie.be%2Fcm%2Fvrtnieuws%3Fmode%3Datom")))
(set-port! U "false")
(newline)
(display (get-port U))
(newline)
(vector-set! (body U)
port
"badumtush")
(display (get-port U))
(newline))
result
#<global-variable-code>
badumtush

No comments:

Post a Comment