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

Surprisingly for a lisp programmer I’m enjoying developing iPhone apps.  My clients Melbourne GigGuide app is doing well and I’m much happier after moving from XML to JSON format for my data feeds.

Verbose

Objective-C is simpler than C++ and closer to a scripting language in some ways.  The UIKit api itself is well designed, despite having verboseMethodNames.  This isn’t so much an RSI problem – the XCode editor does a nice job of guessing and auto-complete, while being non-intrusive – but its a lot of text to read which tends to obscure the idea behind the code.

Deeply nested JSON trees

Today I found myself chaining down a few levels of nested json objects, and decided I needed a much shorter syntax.

Many scripting languages have an associative array lookup syntax like someMap[“key”], and these can be chained.  In Obj-C, to access an NSDictionary you use objectForKey:@”key”.

at() Hack

I wanted something shorter so wrote this small hack  –

id at(id ob, NSString* k)
{
 if (ob && [ob isKindOfClass:[NSDictionary class]])
     return [ob objectForKey:k];
 return NULL;
}

Now I can index down several levels into a json tree easily, like this :

id obShops = at(at(at(json, @”Boutiques”), @”London”), @”EastEnd”);

Not as succinct as square brackets, but saves a lot of typing… enjoy

After seeing some discussion about Kernel Tracing tools in the recent Linux Kernel Summit…I found this great tech-talk.

Dtrace is like ‘TiVo for the Kernel’ … its been included in FreeBSD and Solaris, but Linux is unlikely to embed it directly due to the incompatibility of the GPL with Dtrace’s licence.

Great Dtrace google talk video by one of the developers Bryan Cantrell [his blog here]…

Hilarious discussion of seeing into all the abstract layered levels that is software, nice demo tracing into both kernel and user space programs.

At the end he talks a while about how to view into scripting languages – normally you’d just see rbeval [for ruby] or the JVM implementation – but he decribes how to extend further to Dtrace into scripting Environments.   Superb!

He makes some frank comments about the political situation of porting Dtrace to Linux.

Perhaps solution is to make a clean room GPL  impl from the external API.. watch this space.

Whats immediately apparent from this talk is how useful Dtrace is for developers and sysadmins.

[ fyi, Im working on an ‘attolisp’ scripting implementation for vfuncs.. hmm.. now how to instrument it?  Can you believe nanolisp, picolisp and femtolisp project names were taken! what an embarrassment of riches! :]

It seems to me the time is ripe for Visual DSLs to appear in the financial quantitative domain – you can imagine the pure housekeeping involved in having 2500 trade strategies operating across 3500 tick feeds.. hmmm.

So you might be asking what the hell is a DSL?  A DSL or Domain Specific Language can mean many things, but usually falls into 2 classes – Visual and Textual.

Say I want to create a web app that generates some HTML page dynamically… regardless of whether I program in Ruby or Lisp I really want a nicer way to open and close HTML tags than

print('<html>\n') ... print(</html>\n')

… a textual DSL gives you a language that is a much closer match to the problem .. I want to just write something like

Read the rest of this entry »