Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to create functions in apl2c?

63 views
Skip to first unread message

kens....@gmail.com

unread,
Jul 24, 2008, 2:59:57 AM7/24/08
to
I'm using apl2c 5.0.4, and I just can't figure out how to use the
function editor. I'm following the manual and I hit shift-enter to
open the function editor, enter my function, and then hit shift-enter
again, but I get "Definition error in line 0!". I've tried every
variation I can think of, but nothing works. The only way I can
escape the function editor is hitting esc and canceling out.

I would be grateful if someone can tell me the secret to function
creation in apl2c.

Thanks,
Ken

David Liebtag

unread,
Jul 24, 2008, 11:28:24 AM7/24/08
to
Is your first line a valid header? It should have one of these forms (for a
function)

NILLADIC_WITH_NO_RESULT
RESULT <- NILLADIC_WITH_RESULT
MONADIC_WITH_NO_RESULT RIGHT_ARGUMENT
RESULT <- MONADIC_WITH_RESULT RIGHT_ARGUMENT
LEFT_ARGUMENT DYADIC_WITH_NO_RESULT RIGHT_ARGUMENT
RESULT <- LEFT_ARGUMENT DYADIC_WITH_RESULT RIGHT_ARGUMENT

Any of these forms can be followed by a semi-colon delimited list of local
names.

David Liebtag

PS. Sorry if you already knew all this.


kens....@gmail.com

unread,
Jul 24, 2008, 6:45:20 PM7/24/08
to
On Jul 24, 8:28 am, "David Liebtag" <DavidLieb...@vermontel.net>
wrote:

> Is your first line a valid header? It should have one of these forms (for a
> function)
>
> NILLADIC_WITH_NO_RESULT
> RESULT <- NILLADIC_WITH_RESULT
> MONADIC_WITH_NO_RESULT RIGHT_ARGUMENT
> RESULT <- MONADIC_WITH_RESULT RIGHT_ARGUMENT
> LEFT_ARGUMENT DYADIC_WITH_NO_RESULT RIGHT_ARGUMENT
> RESULT <- LEFT_ARGUMENT DYADIC_WITH_RESULT RIGHT_ARGUMENT
>
> Any of these forms can be followed by a semi-colon delimited list of local
> names.

Thanks for the reply. I've tried various of those, both upper and
lower case, and I can't make apl2c happy.
For instance:
[0] FOO
[1] 42
(The [0] is inserted by the editor; I'm not typing it.)
or
[0] r<-foo
[1] r<- 42
(where <- is an arrow of course)
Whatever I try, I get Definition error in line 0.

Ken

Paul Houle

unread,
Jul 24, 2008, 7:11:54 PM7/24/08
to
It works for me Ken.
In a clear workspace, on a blank line...

{shift}{enter}
[0] R<-FOO{enter}
[1] R<-10{enter}
[2] {shift}{enter}
FOO

APL2C can be finicky. Can you {Quad}FX a simple function? Perhaps
something in the workspace/install is messed up.
...Paul Houle

<kens....@gmail.com> wrote in message
news:98fdae79-1c3d-42df...@w39g2000prb.googlegroups.com...

kens....@gmail.com

unread,
Jul 25, 2008, 2:07:07 AM7/25/08
to
On Jul 24, 4:11 pm, "Paul Houle" <asmg...@yahoo.com> wrote:
> It works for me Ken.
> In a clear workspace, on a blank line...
>
> {shift}{enter}
> [0] R<-FOO{enter}
> [1] R<-10{enter}
> [2] {shift}{enter}
> FOO

Thanks for the detailed instructions. Unfortunately, I still get
"Declaration error in line 0". I tried installing on a different
machine, but got the same thing. What version are you running? (I'm
using 5.0.4 from Help->About)


>
> APL2C can be finicky. Can you {Quad}FX a simple function? Perhaps
> something in the workspace/install is messed up.

{Quad}FX works just fine, strangely enough. I guess that's a
workaround.

Ken

> ...Paul Houle

Paul Houle

unread,
Jul 25, 2008, 2:25:20 AM7/25/08
to
Ken,
I am running version 5.03. I'm surprised to hear there is a later version.
Where did you get it?

Perhaps it is something in your APL2C Setup (though I'm not sure what). As
for me:

Setup->keyboard == APL classic style - English keyboard
Setup->font == APL2C Bold 12 (don't ask me why the font would
matter)
Setup->character encoding == APL2C character encoding
Setup->ascii tokens == off
Setup->ascii token definitions == Standard
Setup->compiler == Microsoft Visual C++

Not sure what else could differ between us. I use Microsoft XP
Professional.
There may be some issue with different OS's; also, there is an installation
incompatibility with multi-core CPU's as well.

Perhaps the author of APL2C could help you. You might try:
con...@apl2c.com
Dr. Tilman Otto was very helpful to me in the past when I was developing a
freeware application with his compiler.
But I don't think he is actively supporting it now.

...Paul Houle

<kens....@gmail.com> wrote in message
news:66d68d5d-0189-4065...@b30g2000prf.googlegroups.com...

Dick Bowman

unread,
Jul 25, 2008, 2:50:26 AM7/25/08
to
I just tried this (had APL2C on this machine for a while, but left it
dormant since APL2C seemed to stop being a living project).

My version is also 5.0.4.

I've defined functions in the past, but today I'm seeing the same problems
as the original poster. And I have to force APL2C to quit using Task
Manager.

Never did like the way its function editor was so pernickety - defining
"something", even if it's "bad" and needs sorting out later, seems to me a
valid approach to building code.

The good news is that there are other low-cost APLs out there which aren't
so "delicate". I didn't find any good reason for doing very much with
APL2C (its USP of generating C code didn't do much for me). Pity, in a
way, because having alternative interpreters feels like a good thing for
the APL user.

"Paul Houle" <asm...@yahoo.com> wrote in
news:lleik.16276$mh5....@nlpi067.nbdc.sbc.com:

> Ken,
> I am running version 5.03. [... deleted ...]

kens....@gmail.com

unread,
Jul 27, 2008, 2:01:22 AM7/27/08
to
Paul Houle wrote:
> Ken,
> I am running version 5.03. I'm surprised to hear there is a later version.
> Where did you get it?

I downloaded 5.0.4 off the apl2c website; it seems to be the only
version currently available.

> Perhaps it is something in your APL2C Setup (though I'm not sure what). As
> for me:
>
> Setup->keyboard == APL classic style - English keyboard
> Setup->font == APL2C Bold 12 (don't ask me why the font would
> matter)
> Setup->character encoding == APL2C character encoding
> Setup->ascii tokens == off
> Setup->ascii token definitions == Standard
> Setup->compiler == Microsoft Visual C++
>
> Not sure what else could differ between us. I use Microsoft XP
> Professional.

Thanks for the detailed setup information. I tried your setup values
on XP, and also tried installing on a different machine, and no luck.

So it seems like function editing in 5.0.4 doesn't work :-(

(By the way, you can't exit apl2c while in this bad function edit
state. The way to get out is hit Esc.)

Ken

del

unread,
Jul 30, 2008, 6:42:45 AM7/30/08
to

What is FOO in the workspace? It should NOT be a variable. If it is
erase it first or rename your fn name to something else.
Stack pending could be a problem too. I don't know APL2C but there is
a )RESET command in most other APLs. You can use it if you have a
stack pending.

jben...@ipm.com

unread,
Mar 16, 2013, 6:19:25 PM3/16/13
to
Sorry for replying 5 years late :-), but I figured out the solution to this issue a couple of years ago: APL2C's editor is not comaptible with current versions of Microsoft riched20.dll. The version from the original Windows XP CD does work so, regardless of what OS version you're currently using (I've tested this sccessfully on Windows 7 and Windows 8, both 64-bit), place a copy of the older riched20.dll into the APL2C folder (I have version 5.30.23.1210) and, to ensure that apl2c.exe uses it rather than whatever version is in your System32 folder, add an empty file named "apl2c.exe.local" to the folder as well. The editor should now function as documented.

Jacques.
0 new messages