🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #321

Re: multi-dimensional switch statements

#321
From: jozwiak
Date: Sun, 23 Jul 1989 19:35
44 lines
1684 bytes

 The language ISetL, for Interactive Set Language, allows _maps_
as first class objects, and as such allows one to build n-dimensional
switch statements:

        { [0, {[1,"cat"],
               [2,"dog"] 
              }
          ],
          [1, {[1,"panther"],
               [2,"wolf"   ]
              }
          ]
        }(0)(2);
"dog";

 Similarly, since functions are first-class objects, as are sets (and
maps as a special case thereof), one may write:

 cat := func(); printf "cat"; end;
 dog := func(); printf "dog"; end;

 switch:= { [0, {[1,cat],
                 [2,dog]
                }
            ],
            [1, {[1,func(); printf "panther"; end],
                 [2,func(); printf "wolf";    end]
                }
            ]
          };
 switch(0)(1);
!FUNC(5cf98/5e700)!;
 switch(0)(1)();
catOM;

 There the system printed the word "cat", after which, as the system does,
printed the return value of the application, which was here the ISETL 
object OM (the undefined object).

 I hope this is an example of the sort for which you looked,
   john jozwiak
   jozwiak@uicsrd.csrd.uiuc.edu
Technical Details
Message-ID: <49100001@uicsrd.csrd.uiuc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!uxc.cso.uiuc.edu!uxc.cso.uiuc.edu!ux1.cso.uiuc.edu!uicsrd.csrd.uiuc.edu!jozwiak
References: <26584@agate.BERKELEY.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!uxc.cso.uiuc.edu!uxc.cso.uiuc.edu!ux1.cso.uiuc.edu!uicsrd.csrd.uiuc.edu!jozwiak
From: jozwiak@uicsrd.csrd.uiuc.edu
Newsgroups: comp.lang.misc
Subject: Re: multi-dimensional switch statements
Message-ID: <49100001@uicsrd.csrd.uiuc.edu>
Date: 23 Jul 89 19:35:00 GMT
References: <26584@agate.BERKELEY.EDU>
Lines: 44
Nf-ID: #R:agate.BERKELEY.EDU:26584:uicsrd.csrd.uiuc.edu:49100001:000:1123
Nf-From: uicsrd.csrd.uiuc.edu!jozwiak    Jul 23 14:35:00 1989