Skip to main content
edited body
Source Link
gigiair
  • 2.3k
  • 1
  • 10
  • 15

You can do it using this macro

(defmacro normalize-list(l n)
  "empties the list lL when its size reaches N"
  `(if(>=(length ,l),n)(setq ,l '())))

Examples

(setq slist'(foo bar baz)) ;->(foo bar baz)

(normalize-list slist 2);->nil

slist ;->(foo bar baz)

(normalize-list slist 5);->nil

slist;->nil

You can do it using this macro

(defmacro normalize-list(l n)
  "empties the list l when its size reaches N"
  `(if(>=(length ,l),n)(setq ,l '())))

Examples

(setq slist'(foo bar baz)) ;->(foo bar baz)

(normalize-list slist 2);->nil

slist ;->(foo bar baz)

(normalize-list slist 5);->nil

slist;->nil

You can do it using this macro

(defmacro normalize-list(l n)
  "empties the list L when its size reaches N"
  `(if(>=(length ,l),n)(setq ,l '())))

Examples

(setq slist'(foo bar baz)) ;->(foo bar baz)

(normalize-list slist 2);->nil

slist ;->(foo bar baz)

(normalize-list slist 5);->nil

slist;->nil
edited body
Source Link
gigiair
  • 2.3k
  • 1
  • 10
  • 15

You can do it using this macro

(defmacro normalize-list(l n)
  "empties the list l when its size reaches N"
  `(if(>=(length ,l),n)(setq ,l '())))

Examples

(setq slist'(foo bar baz)) ;->(foo bar baz)

(normalize-list slist 52);->nil

slist ;->(foo bar baz)

(normalize-list slist 35);->nil

slist;->nil

You can do it using this macro

(defmacro normalize-list(l n)
  "empties the list l when its size reaches N"
  `(if(>=(length ,l),n)(setq ,l '())))

Examples

(setq slist'(foo bar baz)) ;->(foo bar baz)

(normalize-list slist 5);->nil

slist ;->(foo bar baz)

(normalize-list slist 3);->nil

slist;->nil

You can do it using this macro

(defmacro normalize-list(l n)
  "empties the list l when its size reaches N"
  `(if(>=(length ,l),n)(setq ,l '())))

Examples

(setq slist'(foo bar baz)) ;->(foo bar baz)

(normalize-list slist 2);->nil

slist ;->(foo bar baz)

(normalize-list slist 5);->nil

slist;->nil
added 1 character in body
Source Link
gigiair
  • 2.3k
  • 1
  • 10
  • 15

You can do it using this macro

(defmacro normalize-list(l n)
  "empties the list l when its size reaches N"
  `(if(=>=(length ,l),n)(setq ,l '())))

Examples

(setq slist'(foo bar baz)) ;->(foo bar baz)

(normalize-list slist 5);->nil

slist ;->(foo bar baz)

(normalize-list slist 3);->nil

slistslist;->nil

You can do it using this macro

(defmacro normalize-list(l n)
  "empties the list l when its size reaches N"
  `(if(=(length ,l),n)(setq ,l '())))

Examples

(setq slist'(foo bar baz)) ->(foo bar baz)

(normalize-list slist 5)->nil

slist->(foo bar baz)

(normalize-list slist 3)->nil

slist->nil

You can do it using this macro

(defmacro normalize-list(l n)
  "empties the list l when its size reaches N"
  `(if(>=(length ,l),n)(setq ,l '())))

Examples

(setq slist'(foo bar baz)) ;->(foo bar baz)

(normalize-list slist 5);->nil

slist ;->(foo bar baz)

(normalize-list slist 3);->nil

slist;->nil
Source Link
gigiair
  • 2.3k
  • 1
  • 10
  • 15
Loading