Menu

#599 maplist inconsistent with args

None
not-a-bug
Lisp Core (457)
4
2022-05-19
2004-09-27
No

maplist(foo,a[i]) => error

while

map(foo,args(a[i])) => [foo(i)]

I'd think these should do the same thing, especially
since maplist does act like a "part" function in other
ways (e.g. in respecting inflag).

-s

Discussion

  • Robert Dodier

    Robert Dodier - 2006-07-31
    • labels: --> Lisp Core
     
  • Robert Dodier

    Robert Dodier - 2006-07-31

    Logged In: YES
    user_id=501686

    In 5.9.3cvs, maplist(foo, a[i]) => error and also map(foo,
    a[i]) => error.

    maplist(foo, a[i]) should yield [foo(i)] as suggested above.
    map(foo, a[i]) should yield a[foo(i)] (by analogy with
    map(foo, a(i))).

     
  • Kris Katterjohn

    Kris Katterjohn - 2016-12-15

    I agree that this seems inconsistent:

    (%i1) map (foo, bar (i, j, k));
    (%o1) bar(foo(i),foo(j),foo(k))
    
    (%i2) map (foo, bar [i, j, k]);
    map: improper argument: bar[i,j,k]
     -- an error. To debug this try: debugmode(true);
    

    But since bar[i,j,k] is a mapatom, isn't this the expected behavior? To change this we would need to change the definition of a mapatom.

    Was changing mapatom implicit in the previous comments, or...?

     
  • Kris Katterjohn

    Kris Katterjohn - 2021-11-10

    Hi Stavros, Robert. Can we close this as not-a-bug based on my comment from 5 years ago?

    From what I see, Stavros was initially suggesting changing maplist only. Then Robert generalized this to other mapping functions. It looks like my comment from 5 years ago was based mostly on Robert's comment.

    I do see Stavros' point about the inconsistency, but I think maplist being different than other mapping functions w.r.t. mapatoms is also inconsistent.

    I think we should keep the current behavior.

     
  • Kris Katterjohn

    Kris Katterjohn - 2022-05-13

    I left my first comment in this ticket over 5 years ago and I left another about 6 months ago.

    I'll close this ticket as not-a-bug soon (probably next week) unless anyone wants to comment in favor of the original proposal (about maplist only) and/or the follow-up proposal (about other mapping functions too).

     
  • Kris Katterjohn

    Kris Katterjohn - 2022-05-18
    • status: open --> not-a-bug
    • assigned_to: Kris Katterjohn
    • Group: --> None
     
  • Kris Katterjohn

    Kris Katterjohn - 2022-05-18

    Closing as not-a-bug, per my previous comments.

     
  • Robert Dodier

    Robert Dodier - 2022-05-19

    Haha, it's funny to think I first encountered this bug report almost 15 years ago ... how time fled.

    Anyway I agree that changing the behavior of map(foo, a[i]) implies a change in the definition of mapatom, which I guess I'm not in favor of. So it makes sense at this point to close this ticket as not a bug.

     

Log in to post a comment.