smalltalk-tng

view r3/my-name-in-binary.tng @ 323:454c18798969

merger
author Tony Garnock-Jones <tonygarnockjones@gmail.com>
date Tue Feb 07 11:34:20 2012 -0500 (3 months ago)
parents
children
line source
1 "
2 (list->string
3 (map (lambda (x) (integer->char (+ 96 (string->number x 2))))
4 (map list->string
5 (unfold null?
6 (lambda (x) (take x 5))
7 (lambda (x) (drop x 5))
8 (map (lambda (x) (cdr (assq x '((#\/ . #\1) (#\\ . #\0)))))
9 (string->list ""/\\/\\\\\\////\\///\\//\\\\/\\\\///""))))))
10 "
12 map: [digits: ((digits as: Integer base: 2) + 96 as: Character encoding: Encoding::Ascii)]
13 over: (unfold: (map: [$/: $1 $\: $0] over: '/\/\\\////\///\//\\/\\///')
14 until: [seed: seed isEmpty]
15 with: [seed: (seed take: 5, seed drop: 5)])
17 map [digits: ((digits as: Integer base: 2) + 96 as: Character encoding: Encoding::Ascii)]
18 (unfold until: .isEmpty er
19 with: [seed: (seed splitAt: 5)]
20 seed: (map [$/: $1 $\: $0] '/\/\\\////\///\//\\/\\///'))
22 map [x: ((fold: [(d,n): d + (n * 2)] seed: 0 over: x) + 96
23 as: Character encoding: Encoding::Ascii)]
24 (unfold until: .isEmpty er
25 with: [seed: (seed splitAt: 5)]
26 seed: (map [$/: 1 $\: 0] '/\/\\\////\///\//\\/\\///'))