An entertaining use of del

For users of dfns, both novice and expert

An entertaining use of del

Postby paulmansour on Sun Jul 07, 2013 8:31 pm

So late last night in an attempt to come up with a quick and dirty object-oriented framework for building up HTML, I wrote this:

Code: Select all
     e t←(2=≡⍵)⊃(⍵'')⍵

I particularly enjoyed line 7:


I have not seen this use of del anywhere in the dfns namespace that I could find.

This little dfn lets me write:

      h←Add 'html'
b←h.Add 'body'
h1←b.Add 'h1' 'My Heading'

Which then can be turned into HTML with an appropriately coded render function:

      Render h
<html><body><h1 class="MyClass" id="MyID">My Heading</h1></body></
Posts: 262
Joined: Fri Oct 03, 2008 4:14 pm

Re: An entertaining use of del

Postby StefanoLanzavecchia on Mon Jul 08, 2013 11:57 am

Very nice!
User avatar
Posts: 61
Joined: Fri Oct 03, 2008 9:37 am

Return to Functional Programming

Who is online

Users browsing this forum: No registered users and 1 guest