[racket] stuck at operating text from file
On Sun, Oct 24, 2010 at 11:18 AM, 김태윤 <kty1104 at gmail.com> wrote:
> #xf or #x1 works but
> (crop #x(second (string->list each))
> #x(third (string->list each))
> 32 32
> (bitmap "a.png")))
> it doesn't working at all
The #x syntax is used by the reader to interpret the text that
follows. By the time your code is running the reader has done its job.
Thus you cannot might code values and reader syntax. At run time you
can convert a string to number using string->number. To do the
conversion in base 16 you call it thus: (string->number string 16)
> (define (a-tile each)
> (crop (second (string->list each))
> (third (string->list each))
> 32 32
> ;(bitmap (string->path (string-append (first each) ".png"))
> doesn't work
You are missing string->list here. It should be (list->string (first
(string->list each))), following the other examples above. This is
probably a bad design.
> (bitmap "a.png")))
HTH,
N.