How to create functions in apl2c?

This is a discussion on How to create functions in apl2c? within the APL forums in Programming Languages category; 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...

Go Back   Application Development Forum > Programming Languages > APL

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-24-2008, 02:59 AM
kens.test1@gmail.com
Guest
 
Default How to create functions in apl2c?

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
Reply With Quote
  #2  
Old 07-24-2008, 11:28 AM
David Liebtag
Guest
 
Default Re: How to create functions in apl2c?

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.


Reply With Quote
  #3  
Old 07-24-2008, 06:45 PM
kens.test1@gmail.com
Guest
 
Default Re: How to create functions in apl2c?

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

>
> David Liebtag
>
> PS. Sorry if you already knew all this.


Reply With Quote
  #4  
Old 07-24-2008, 07:11 PM
Paul Houle
Guest
 
Default Re: How to create functions in apl2c?

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.test1@gmail.com> wrote in message
news:98fdae79-1c3d-42df-ab1e-d8d434f220ae@w39g2000prb.googlegroups.com...
> 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
>
>>
>> David Liebtag
>>
>> PS. Sorry if you already knew all this.

>



Reply With Quote
  #5  
Old 07-25-2008, 02:07 AM
kens.test1@gmail.com
Guest
 
Default Re: How to create functions in apl2c?

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

Reply With Quote
  #6  
Old 07-25-2008, 02:25 AM
Paul Houle
Guest
 
Default Re: How to create functions in apl2c?

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:
contact@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.test1@gmail.com> wrote in message
news:66d68d5d-0189-4065-b424-595967316c55@b30g2000prf.googlegroups.com...
> 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



Reply With Quote
  #7  
Old 07-25-2008, 02:50 AM
Dick Bowman
Guest
 
Default Re: How to create functions in apl2c?

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" <asmguru@yahoo.com> wrote in
news:lleik.16276$mh5.5675@nlpi067.nbdc.sbc.com:

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


Reply With Quote
  #8  
Old 07-27-2008, 02:01 AM
kens.test1@gmail.com
Guest
 
Default Re: How to create functions in apl2c?

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

> 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:
> contact@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

Reply With Quote
  #9  
Old 07-30-2008, 06:42 AM
del
Guest
 
Default Re: How to create functions in apl2c?

On Jul 24, 7:59 am, kens.te...@gmail.com wrote:
> 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


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.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 10:01 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.