Skip to content
/ cl-mv Public

Common lisp utilities for multiple values.

Notifications You must be signed in to change notification settings

FiV0/cl-mv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cl-mv

Common lisp utilities for multiple values. Multiple facilities come from Paul Graham's Book on lisp.

Usage

The library currently exposes 5 symbols.

mvpsetq - psetq for multiple values.

(let (a b c d)
 (mvpsetq (a b) (values 1 2) (c d) (floor 19 5))
 (list a b c d))
;; -> (1 2 3 4)

mvdo* - do* for multiple values.

(mvdo* ((res nil (append res (list j k)))
        (i 1 (1+ i))
        ((j k) (floor 100 i) (floor 100 i)))
       ((> i 3) res))
;; -> (100 0 50 0 33 1)

mvdo - do for multiple values.

(mvdo ((res nil (append res (list j k)))
        (i 1 (1+ i))
        ((j k) (values -1 -1) (floor 100 i)))
       ((> i 3) res))
;; -> (-1 -1 100 0 50 0)

mvlet* - let* for multiple values.

(mvlet* (((i j) (values 1 2))
         (k 3)
         ((l) (values k))
         ((m n) (values k l)))
  (list i j k l m n))
;; -> (1 2 3 3 3 3)

mvlet - let for multiple values.

(let ((i 3) (j 2) (k 1))
  (mvlet (((i j) (values 5 4))
          ((k l) (values i j))
          (m k))
    (list i j k l m)))
;; -> (5 4 3 2 1)

License

Be aware that big parts of the code come from Paul Graham's Book on lisp. I couldn't find any Licence information for that code, so use at your own risk.

The remaining parts are licenced under vanilla MIT Licence.

About

Common lisp utilities for multiple values.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published