CC.(US CA AU BR) <- 1 1 61 55
This works in Version 10.1
This is a discussion on APL in its ghetto (?) - Programming Languages ; On Wed, 28 Dec 2005 11:49:33 -0600, TaliesinSoft wrote (in article <0001HW.BFD82C4D0001EBBDF0284550@news.supernews.com>): [color=blue] > In Dyalog APL I can do the following > > a) Create a namespace CC with the appropriate system command or system > function > > ...
On Wed, 28 Dec 2005 11:49:33 -0600, TaliesinSoft wrote
(in article <0001HW.BFD82C4D0001EBBDF0284550@news.supernews.com>):
[color=blue]
> In Dyalog APL I can do the following
>
> a) Create a namespace CC with the appropriate system command or system
> function
>
> b) Assign variables within CC
>
> CC.US <- 1
> CC.CA <- 1
> CC.AU <- 61
> CC.BR <- 55
>
> c) look up country code for a given country
>
> CC.US
> 1
> CC.BR
> 55[/color]
I forgot to mention that the above namespace assignment could have been
written as
CC.(US CA AU BR) <- 1 1 61 55
and that one can also write such as
CC.(US AU)
1 61
to look up more than a single country code.
That aside, I'm curious as if there is a reason that one can't write, in a
clear workspace
CC.(US CA AU BR) <- 1 1 61 55
and because CC is undefined it can't by default create a namespace. If there
is a conflict or ambiguity I'd like to know.
--
James L. Ryan -- TaliesinSoft
CC.(US CA AU BR) <- 1 1 61 55
This works in Version 10.1
Sorry!
I think I jumped the gun a bit. It works if CC exists, fails it it does
not, probably because of the implicit reference to children (US CA AU BR)
of a parent CC which does not exist.
On Thu, 29 Dec 2005 02:09:04 -0600, AA2e72E wrote (in article
<abbe0a29824c4ef37187e9462792950c@localhost.talkaboutprogramming.com>):
[color=blue]
> Sorry! I think I jumped the gun a bit. It works if CC exists, fails it it
> does not, probably because of the implicit reference to children (US CA AU
> BR) of a parent CC which does not exist.[/color]
In APL one can write the expression
A <- 5
and if at the time A is undefined a variable will be created. That is, no
declaration was needed.
It seems to me that one ought to be able to write
A.B <- 5
and if at the time A is undefined a namespace will be created.
My question is whether in this case there is any ambiguity in doing so,
--
James L. Ryan -- TaliesinSoft
There is ambiguity: there is no way of knowing what A is. Consider this:
1) A.DisplayAlerts
2) A.b{comes from}1
1) will work if <A> is an OLE instance of Excel.Application, thus:
'A' []wc 'OLEClient' 'Excel.Application'
2) will work if <A> is a namespace, thus:
)ns A
If <A> does not exist, it can be anything (any type of object), hence the
ambiguity.
I suppose the question you are asking is this:
If an object does not exist, can it be presumed to be a namespace, and,
can the interpreter create it implicitly? I think this is dangerous,
especially when taken to its logical conclusion. For instance, what would
you expect this expression to return:
doesnotexist <followed by enter>
I think VALUE ERROR is the only valid response. You could argue that it
might be presumed to be a variable by default (why not a function?), and
then, what would its value be, '' or 0{shapeof)0, or simply 0?
With APL+Win, objects have User-defined properties whose names begin with
a reserved character. A reference to a name/property that does not exist
yields 0. APLX has the same facility, only a reference to a non-existing
name yields VALUE ERROR. I think the APLX behaviour is more 'correct'.
Jim,
Interesting question. Couple of observations:
What about A.B.C.D <-5, where A exists, but not B C and D?
It may be that asking the interpreter to create a namespace for you as
you try to stuff something in non-existing space is equivalent to
allowing the expression A[1]<-5 to work even if A does not exist.
Would certainly be nice if we could create new namespaces without the
[]NS '' though.
phil chastney a écrit :
[color=blue][color=green]
>> - simple to use (if possible !) *graphic interface* , ideally builtin.[/color]
>
>
> ideally, NOT built in
>
> keep the IDE separate from the language -- I really do NOT want to
> learn the idiosyncracies of a new editor, each time I change language[/color]
Aah, this looks like the )EDITOR controversy in the time of good old
mainframes :
- *Either* you have *horizontal* homogeneity, the same editor for the
same language whatever the system you use is (VM/CMS, MVS/TSO...)
- *Or* you have *vertical* homogenity, the same editor on the same
system, and *lose* the horizontal homogeneity.
The same for graphic interfaces. Nevertheless those interfaces seem
rather mature now, and whether you are in KDE, Gnome or Windows provide
very similar facilities, the user choosing anyway which look and feel
(s)he prefers, not the application developer.
TaliesinSoft a écrit :
[color=blue]
> On Wed, 28 Dec 2005 10:57:24 -0600, Christopher Browne wrote
> (in article <m3k6dpnoqz.fsf@mobile.int.cbbrowne.com>):
>
>[color=green]
>>In Perl, I can specify an associative array of country telephone
>>prefixes, thus:
>>
>> $CC{"US"} = "1";
>> $CC{"CA"} = "1";
>> $CC{"AU"} = "61";
>> $CC{"BR"} = "55";
>> $CC{"FR"} = "33";
>> $CC{"HK"} = "852";
>> $CC{"IN"} = "91";
>> $CC{"IE"} = "972";
>> $CC{"JP"} = "81";
>> $CC{"UK"} = "44";
>>
>>
>>And later, look up the country code for a given country
>>
>> $x = $CC{$some_country};[/color]
>
>
> In Dyalog APL I can do the following
>
> a) Create a namespace CC with the appropriate system command or system
> function
>
> b) Assign variables within CC
>
> CC.US <- 1
> CC.CA <- 1
> CC.AU <- 61
> CC.BR <- 55
>
> c) look up country code for a given country
>
> CC.US
> 1
> CC.BR
> 55[/color]
Fine, Jim, but what do you do if you want to index with plain strings,
without restrictions ? I guess
CC.'United States of America' will not do :-(
We just *cannot* ask people to code their information as we had to to in
the 60s and 70s, mostly because a good part of the information they want
to deal with comes directly from the Internet.
Paul Mansour a écrit :
[color=blue]
> Isn't this about as generic a question as "what do people want to work
> with then they build something nowadays?" What are you building? A
> house? A car? A laptop? An oil refinery?
>[/color]
I would say that whatever you are trying to build, you are going to need
a computer for text-processing and electronic mail, ans a billing facility.
Concerning basig needs, I fail to see any application, except intensive
numerical computing, that does not need at one place or another to store
information indexing it *by name* , not *by numbers* as APL arrays do.
In fact, *more* people need associative indexing than array indexing,
nowadays.
Even if it can be handled by the application, reprogramming it every
time increases maintenance costs and looks like reinventing warm water
every time.
TaliesinSoft a écrit :
[color=blue]
> I forgot to mention that the above namespace assignment could have been
> written as
>
> CC.(US CA AU BR) <- 1 1 61 55
>
> and that one can also write such as
>
> CC.(US AU)
> 1 61
>
> to look up more than a single country code.
>
> That aside, I'm curious as if there is a reason that one can't write, in a
> clear workspace
>
> CC.(US CA AU BR) <- 1 1 61 55
>
> and because CC is undefined it can't by default create a namespace. If there
> is a conflict or ambiguity I'd like to know.[/color]
Why use the dot when the bracket already exists ?
CC['US' 'CA' 'AU' 'BR'] <- 1 1 61 55
It seems *much* more user-friendly, as the concept is exactly parallel
to what we already have with regular APL indexing, and so does not need
to learn a syntax addition. It is just extended with backwards
compatibility (except that what caused one a "syntax error" does not
anymore. Remember the "NONCE ERROR" at the beginning of APL\360?