[Jprogramming] listatom equivalent of boxopen
Roger Hui
rhui000 at shaw.ca
Fri Jun 22 10:02:48 HKT 2007
,^:(0=#@$)
----- Original Message -----
From: "Sherlock, Ric" <R.G.Sherlock at massey.ac.nz>
Date: Thursday, June 21, 2007 6:42 pm
Subject: [Jprogramming] listatom equivalent of boxopen
> I was looking for a phrase that would make an atom (rank 0) into a
> 1-item list, but leaves anything else "as is".
> Something like this but without the control structure.
> if. 0=#$y do. ,y end.
>
> I searched as much as I could through Wiki, forum and J system,
> but had
> no luck. I may well have been searching for the wrong words!
>
> Anyway I figured that what I wanted was essentially the same as the
> boxopen verb
> boxopen=: <^:(L.=0:)
> and so I came up with this which seems to do the job.
> listatom=: ,^:(#@:$ = 0:)
>
> Are there other simpler ways of doing this?
More information about the Programming
mailing list