You are currently browsing the tag archive for the ‘map’ tag.

Maps

I prototype a number of techniques to deliver interactive floor maps.

Here is a floor plan of the main area of Melbourne Central, a popular shopping area in the CBD.  Created with SVG + javascript so will only run in Browsers that understand SVG.

Melbourne Central Map SVG

These kind of maps would be very useful navigating large Expos, so here are some demos…

Standard divs approach :

Home Garden Show

Fashion Exposed

SVG versions, for modern browsers only  :

Home Garden Show

Fashion Exposed

Impressions

All in all SVG is an incredible format for these kinds of graphics, and I think well see a lot more interactive books, comics and StarTrek inspired custom UIs developed in SVG.   Its a sane way to deliver to iPhone, iPad and various Android screen sizes with  common code base and one set of graphics assets.

After many years of neglect and non-standards-compliance, I’m looking forward to seeing the upcoming IE9 release of Internet Explorer browser with accelerated graphics and native SVG support.  Graphic designers will be set free to create and developers will be empowered to push the boundaries of the web to the next level.

Objective-C can be quite verbose, especially when handling nested data – there is no simple associative array indexing of the kind found in PHP, Ruby etc.

ObjC : verbose : id value = [map objectForKey:@”key”];

Using atx functions : concise : id value = at(map, @”key”);

This comes in very handy for deeply nested json data trees, where you might want to index a multidimensional array or nested tree – vis :

id pop = at(at(at(stats, @”USA”), @”NewYork”), @”popn”);

Not quite as simple as pop = stats[“USA”][“NewYork”][“popn”]; but more readable than several objectForKey’s.  Note, I propagate the nulls up so if an item is not found at any level, it can be checked once at the top level without crashing the app.

The small suite of related functions can be found at google code here, under BSD licence – http://code.google.com/p/xathack/

enjoy.

The embarrassment of riches truly astounds in the domain of ahem ‘very small’ lisp implementations… and who am I to refuse to fill an obvious missing link in the series?  We got small covered…

Yes, I have in fact begun a super cut down lisp implementation for vfuncs, which I think will be a nice way to express such idioms as map [hey, lisp invented map, right? – maybe not, better check ]

I’ve uploaded the new files atto.c, atto.h, attotest.c to the vfuncs project page – grab v0.6.7.

Some of the earlier blog comments around vfuncs got me to wondering.. How would you implement closure and currying in straight C so it could be used in useful array verbs?  It seems what you need is to replace some verb params with values from the ‘environment’.  That way the verb can use both runtime args and design time args easily… I did hack up something, but it began to look more and more like I was writing an interpreter… so I decided the ‘honest, unenlightened hacker’ way to proceed was to actually _write_ an interpreter for as simple a language as I could think of…

The core guts of lisp is, well – calling functions with args, when any of those args could be a const, a variable or another function.  So, the atto-kernel of lisp is something like this grammar [a comment pasted from the C source] –

//      expr : left func args right // (func arg0 arg1 arg2 )
//      args : arg args | empty // args is any length 0..n
//      arg  : ident | const | expr // each arg can be an expr itself – nested calls

In the spirit of ‘start small, get it working and add features’, this cut-down grammar allows you to parse expressions like the following –

//     “(sqrt (add (sqr 3.0) (sqr 4.0)) )”

This is the ‘lisp way’ – everything is in prefix notation ie. (* a b) not (a * b).  You get used to it, and it is very consistent [and the reason lisp macros are more part of the language than say C/C++ macros].

Read the rest of this entry »