Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e5d381830d
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (39 sloc) 1.866 kb
<html>
<head><script src="bootLeisure.js"></script></head>
<body leisureCode class="thin">
#@auto
do
require 'maps'
require 'svg'
foo = hashFromList [ 'foo' 5 'hello' 'world' 'j' 23 ]
bar = hashFromList [ 'bar' 6 'hello' 'sun' 'fruit' 'apple' ]
mergeHash foo bar
###############################
# lets visualize our hashMaps!
###############################
circle nil
rect nil
text 'foopy' defaultCircleMap
decorateArrow = hashFromList [ 'x1' 50 'y1' 25 'x2' 150 'y2' 25 'stroke' 'black' 'stroke-width' 3 ]
decorateKey = hashFromList [ 'x' 0 'y' 0 'rx' 5 'ry' 5 'width' 100 'height' 50 'fill' 'green' 'stroke' 'black' 'stroke-width' 3 ]
decorateValue = hashFromList [ 'x' 150 'y' 0 'rx' 5 'ry' 5 'width' 100 'height' 50 'fill' 'yellow' 'stroke' 'black' 'stroke-width' 3 ]
decorateKtext = hashFromList [ 'x' 10 'y' 25 ]
decorateVtext = hashFromList [ 'x' 160 'y' 25 ]
svgMap = hashFromList [ 'width' 300 'height' 200 ]
paintArrow = concat [ (line decorateArrow) (line (addHash 'x1' 135 (addHash 'y1' 15 decorateArrow))) (line (addHash 'x1' 135 (addHash 'y1' 35 decorateArrow))) ]
paintNode key value offset = translate ( concat [ (paintArrow) (rect decorateKey) (rect decorateValue) (text key decorateKtext) (text value decorateVtext) ] ) 0 offset
derp hm = concat (map (\cell. (paintNode (key cell) (value cell) (heightOffset (key cell) hm) ) ) hm )
heightOffset k hm = + 5 (* (indexof (getKeys hm) k) 75)
paintHash hm = svg ( derp hm ) (addHash 'height' (* 75 (numKeys hm)) svgMap)
(addHash 'height' (* 75 (numKeys foo)) svgMap)
addHash 'height' (* 75 (numKeys svgMap)) svgMap
temp = concat (head (map (\cell. [ (paintNode (key cell) (value cell) 0) ]) foo))
translate "foopy" 10 50
svg (paintNode 'hello' 5 100) svgMap
derp foo
heightOffset 'j' foo
paintHash foo
paintHash bar
paintHash (mergeHash foo bar)
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.