Lisp Community

681 readers
8 users here now

A community for the Lisp family of programming languages.

Lisp (historically LISP) is a family of programming languages with a long history and a distinctive, fully parenthesized prefix notation. Originally specified in 1958, Lisp is the second-oldest high-level programming language. Only Fortran is older, by one year.

History

Associations and meetings

Resources - TODO

Related communities (dialects) - TODO

founded 5 years ago
MODERATORS
26
 
 

cross-posted from: https://lemmy.ml/post/4591838

Suppose I need to find out if the intersection of an arbitrary number of lists or sequences is empty.

Instead of the obvious O(n^2^) approach I used a hash table to achieve an O(n) implementation.

Now, loop mini-language aside, is this idiomatic elisp code? Could it be improved w/o adding a lot of complexity?

You can view the same snippet w/ syntax highlighting on pastebin.

(defun seq-intersect-p (seq1 seq2 &rest sequences)
 "Determine if the intersection of SEQ1, SEQ2 and SEQUENCES is non-nil."
 (cl-do* ((sequences `(,seq1 ,seq2 ,@sequences) (cdr sequences))
          (seq (car sequences) (car sequences))
          (elements (make-hash-table :test #'equal))
          (intersect-p nil))
     ((or (seq-empty-p sequences)) intersect-p)
   (cl-do* ((seq seq (cdr seq))
            (element (car seq) (car seq)))
       ((or intersect-p (seq-empty-p seq)) intersect-p)
     (if (ht-get elements element)
         (setf intersect-p t)
       (ht-set elements element t)))))

(defun test-seq-intersect-p ()
 "Test cases."
 (cl-assert (null (seq-intersect-p '()
                                   '())))
 (cl-assert (null (seq-intersect-p '(1)
                                   '())))
 (cl-assert (null (seq-intersect-p '(1 2)
                                   '(3 4)
                                   '(5 6))))
 (cl-assert (seq-intersect-p '(1 2)
                             '(3 4)
                             '(5 6)
                             '(1)))
 t)

(test-seq-intersect-p)

Version 2

(defun seq-intersect-p (first second & sequences)
  "Determine if FIRST, SECOND and any of the sequences in SEQUENCES have
an intersection."
  (if (seq-empty-p sequences)
      (seq-intersection first second)
    (or (seq-intersection first second)
        (apply #'seq-intersect-p
               first
               (seq-first sequences)
               `,@(seq-rest sequences))
        (apply #'seq-intersect-p
               second
               (seq-first sequences)
               `,@(seq-rest sequences))
        (apply #'seq-intersect-p
               (seq-first sequences)
               (seq-elt sequences 2)
               `,@(seq-rest (seq-rest sequences))))))
27
28
 
 

In the Lisp community @lisp on Lemmy.ml there's a discussion on what your Lisp development environment looks like and how you got started with Lisp. Of course I'm the weirdo who uses Interlisp as his daily driver.

https://lemmy.ml/post/3860996

#lisp

29
 
 

It's Friday, so I though it would be nice to have a social topic here. So here's a bunch of questions to stir up some discussions:

  • Which Lisp do you most often program in?
  • What does your Lisp development environment or IDE look like?
  • How did you get started with Lisp? Did you follow any particular articles to set up your environment or begin learning Lisp?
30
31
 
 

cross-posted from: https://lemmy.ml/post/3549323

John Cowan has resigned as chair of the R7RS-large project.

32
33
34
 
 

Feel free to comment here and/or on the linked Hacker News thread.

35
36
37
38
39
 
 

I'm interested in examples or ideas in any Lisp dialect that supports the feature.

40
1
LispM.de (lispm.de)
submitted 1 year ago* (last edited 1 year ago) by amoroso@lemmy.ml to c/lisp@lemmy.ml
 
 

An extensive and eclectic historical archive of Lisp systems and dialects with a focus on Symbolics Lisp Machines. It stores manuals, research papers and publications, screenshots, videos, source code, documentation, articles, data, links, and other rare material.

41
42
43
44
45
46
 
 
47
48
 
 

For each library I'll create a separate repository with this toy project and some description of pros and cons of used GUI toolkit.

Which Common Lisp UI libraries would you like to see in in this project?

49
 
 

You should give it a try!

50
view more: ‹ prev next ›