You should be automatically redirected . If not, visit
http://newlisper.wordpress.com
and update your bookmarks.

01/04/2006

NetNewsWire

It's not every day of the year that I have to use newLISP to read an entry in NetNewsWire. But today I saw Bill Stevenson's entry for today and had to have a go.

See how long it takes you (I've made it into a string for you):

(set 'bills-message "4F 66 20 63 6F 75 72 73 65 20 65 76 65 72 79 20
79 65 61 72 20 49 20 68 61 76 65 20 74 6F 20 64
6F 20 73 6F 6D 65 74 68 69 6E 67 20 73 69 6C 6C
79 20 6F 6E 20 41 70 72 69 6C 20 46 6F 6F 6C 27
73 20 44 61 79 2E 20 54 68 69 73 20 79 65 61 72
20 69 73 20 6E 6F 20 64 69 66 66 65 72 65 6E 74
2E 20 49 6E 20 6F 72 64 65 72 20 74 6F 20 72 65
61 64 20 74 68 69 73 2C 20 49 20 69 6D 61 67 69
6E 65 20 74 68 61 74 20 79 6F 75 27 64 20 68 61
76 65 20 74 6F 20 73 6F 6D 65 68 6F 77 20 72 65
61 6C 69 7A 65 20 74 6F 20 6F 70 65 6E 20 69 74
20 69 6E 20 61 20 68 65 78 20 65 64 69 74 6F 72
2E 20 53 6F 20 62 72 61 76 6F 20 74 6F 20 79 6F
75 21 20 41 6E 64 20 68 61 76 65 20 61 20 77 6F
6E 64 65 72 66 75 6C 20 41 70 72 69 6C 20 46 6F
6F 6C 27 73 20 44 61 79 21")

Decoding hex entries is the only thing I've encountered that Brent Simmon's ace newsreader can't do!

4 Comments:

At 00:03, Anonymous Anonymous said...

(join (map char (map (fn (x) (integer x 0 16)) (parse bills-message " "))))

 
At 03:19, Anonymous Anonymous said...

when pasting bills-message from the post some line-feeds hex 0A chars slip in, this regex parse takes care of it:

(join (map char (map (fn (x) (int x 0 16)) (parse bills-message {\s+} 0))))

 
At 08:37, Blogger newlisper said...

Good work! I had

(map (fn (h) (print (char (integer (append "0x" h))))) (parse bills-message " |\n" 0))

which is pretty close!

 
At 19:45, Anonymous Anonymous said...

aaa yes..welll I tried variations but you simply cant get around the octet issue in newlisp ;-) nice short solutions..!

 

Post a Comment

Links to this post:

Create a Link

<< Home