bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: APL lambda question


From: Dr . Jürgen Sauermann
Subject: Re: APL lambda question
Date: Thu, 24 Oct 2024 17:30:14 +0200
User-agent: Mozilla Thunderbird

Hi Henrik,

I believe I fixed the Segfault. You should now get
a DEFN ERROR instead with )MORE information.
SVN 1782.

The reason is this:

1, Conditionals, i.e. COND →→ IFSTAT ←→ ELSESTAT ←←
    create 2 or 3 statements, one for COND, one for IFSTAT and
    optionally one for ELSESTAT.

2. GNU APL lambdas are limited to one APL _expression_ (= one APL statement)
   and the _expression_ must yield a value (and can therefore not be a branch).

3. The normal work-around for this limitation is to use a proper ∇-defined function.

Best Regards,
Jürgen


On 10/23/24 21:16, Henrik Moller wrote:
Gave it a try:

     x←6
     y←⍳5  
     (2=⎕nc'x') →→ x⍴y ←→ ⍴y ←←
1 2 3 4 5 1
     )erase x
     (2=⎕nc'x') →→ x⍴y ←→ ⍴y ←←
5

     tryit←{(2=⎕nc'x') →→ x⍴y ←→ ⍴y ←←}


===================================================
SEGMENTATION FAULT
*** useless apl.lines (no CXXFLAGS=-rdynamic -gdwarf-2)

----------------------------------------
-- Stack trace at main.cc:102
----------------------------------------
0x7fd5887171e2 __libc_start_main
0x485c8a  main
0x63dd25   Workspace::immediate_execution(bool)
0x4ef575    Command::process_line()
0x4efbe1     Command::finish_context()
0x4fc307      Executable::execute_body() const
0x5cd5c0       StateIndicator::run()
0x53bb21        Prefix::reduce_statements()
0x53b430         Prefix::push_END_error()
0x536636          Prefix::syntax_error(char const*)
0x4fc0a1           throw_apl_error(ErrorCode, char const*)
0x4fbe3f            Error::update_error_info(StateIndicator*)
0x500770             Executable::set_error_info(Error&, Function_PC2) const
0x7fd588cfd1b0               
0x48b0b7                
========================================
========================================
====================================================


Probably not worth trying to fix this--it's too obscure.



[3] ~tinkering/apl/mtx/src >        




On 10/23/24 12:30, Dr. Jürgen Sauermann wrote:
Hi Hendrik,

as far as I remember: in GNU APL a lambda is pretty much a regular defined function.
A nomadic lambda is simply a dyadic lambda which test for the presence for its left
argument (read: ⎕NC lambda = 2).Tour tryit needs to check that before ⍺ is referenced).

Best Regards,
Jürgen


On 10/23/24 16:55, Henrik Moller wrote:
To all APLers:  In GNU APL, is there any way to define an ambivalent lambda?  I.e., if you define a lambda
tryit←{...}
is there any way to make it work with both
tryit 1
and
1 tryit 2
The Net has been unhelpful...

Thanks




reply via email to

[Prev in Thread] Current Thread [Next in Thread]