Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overloaded method 'intersection' causing error #3

Open
sabu36 opened this issue Dec 21, 2020 · 6 comments
Open

Overloaded method 'intersection' causing error #3

sabu36 opened this issue Dec 21, 2020 · 6 comments

Comments

@sabu36
Copy link

sabu36 commented Dec 21, 2020

On clisp, overloading for sets seems to be conflicting with the built-in one for lists. (I'm a noob so I could be missing something elementary.)

> (intersection '(a b c) '(c d a))
(A C)
> (load "ergolib/init")
…
> (require :ergolib)
…
> (intersection '(a b c) '(c d a))

*** - NO-APPLICABLE-METHOD: When calling
      #<STANDARD-GENERIC-FUNCTION INTERSECTION> with arguments
      ((A B C) (C D A)), no method is applicable.
@rongarret
Copy link
Owner

rongarret commented Dec 21, 2020 via email

@sabu36
Copy link
Author

sabu36 commented Dec 22, 2020

Thanks for detailed explanation.

I imagine you intend to keep this to fundamental and I don't know they qualify but I have some requests:

  • for … setcollect (there's already sforce, which I feel could've been str-; s- reminds me more of set but maybe just me)
  • filter that inputs a set but also outputs a set
  • an equivalent for sets, of built-in set-difference for lists

I think they would enable staying on sets through multiple steps.

@rongarret
Copy link
Owner

rongarret commented Dec 22, 2020 via email

@sabu36
Copy link
Author

sabu36 commented Dec 23, 2020

I'm studying a book called Land of Lisp and set (in terms of list or hash-table) came up in ch.8 (wumpus) and ch.10 (evolution) so far.

Some background on how I started using this library…

I was initially learning the book with Racket because of its pedagogical emphasis but I noticed (I made a table of equivalents):

  • set! doesn't keep track of where the parameter came from, requiring separate setter for each case
  • general version of a function has longer name—e.g., length (for list) vs sequence-length
  • no type dispatching

I then briefly looked at other dialects as well but I decided on Common Lisp featurewise. At that point I wished there was a polished version and then I found your library.


By the way, on names and synonyms…

Scheme/Racket suffixes ? on predicates and ! on mutators. What's your sentiment on this? You have mappend and mappend! so you seem to be using it only to differentiate. Do you want to keep close to official on names?

From the point of view of a learner, it helps if a name has satisfying etymology. For example, princ apparently comes from "PRINt the Characters", which is not very satisfying for me. Scheme/Racket equivalent is display. (An earlier reply in the same link also suggests write-object instead of print-object and write-unreadable-object instead of print-unreadable-object though I never used those yet.) Another unsatisfying name is setf and some people were even confused on the etymology. How about synonyming it as set! since the other variants don't seem that common.

@rongarret
Copy link
Owner

rongarret commented Dec 23, 2020 via email

@sabu36
Copy link
Author

sabu36 commented Dec 25, 2020

When I said "other variants" I actually just meant SETQ and SET in Common Lisp—I didn't know about any variant in other languages—so I was just talking about names on the surface as I'm probably not at the level where I can appreciate what's going on internally.

I've just finished studying the draft and I'm looking forward to seeing how it continues. The book uses an IDE only available for mac so I had to setup emacs and slime (found by searching "meta-point lisp").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants