OpenCores
URL https://opencores.org/ocsvn/core_arm/core_arm/trunk

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [soft/] [cdef/] [cdef_lib_l1.el] - Blame information for rev 6

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tarookumic
; Konrad Eisele <eiselekd@web.de>
2
; cdef_lib_l1.el: Some list functions
3
;-----------------------------------------------------------------------
4
 
5
 
6
(defun rec-copy-list-func (e)
7
  (if (listp e)
8
      (mapcar 'rec-copy-list-func e)
9
   `,e)
10
)
11
 
12
(defun rec-copy-list (l)
13
  "Copy list"
14
  (mapcar 'rec-copy-list-func l)
15
)
16
 
17
(defun cut-copy-list (l start end)
18
  "Copy list and cut range"
19
  (let ((c (rec-copy-list l)))
20
    (if (<= end 0)
21
        (setq c '())
22
        (if (<= end (length c))
23
            (setcdr (nthcdr (- end 1) c) '())
24
        )
25
    )
26
    (nthcdr start c)
27
  )
28
)
29
 
30
(defun cmp* (l e)
31
  "check weather <l> is (make-list x e)"
32
  (let ((v 't)
33
        (el))
34
    (dolist (el l v)
35
      (if (not (eq el e))
36
          (setq v '())
37
      )
38
    )
39
  )
40
)
41
 
42
;(setq l1 '(1 2))
43
;(setq l2 '(3 4 1 2 2 5))
44
;(remq* l1 l2)
45
(defun remq* (ol l)
46
  (let ((e '())
47
        (v (rec-copy-list l)))
48
    (dolist (e ol v)
49
      (setq v (remq e v)))
50
  )
51
)
52
 
53
 
54
(defun print-list (e)
55
  (cond ((listp e)
56
         (concat " ( " (mapconcat 'print-list e " ") " ) " ))
57
        ((symbolp e)
58
         (symbol-name e))
59
        ((numberp e)
60
         (number-to-string e))
61
        ((hash-table-p e)
62
         (let ((p " { hash=>\n"))
63
           (maphash (function (lambda (k v)
64
              (setq p (concat p (print-list k) ":" (print-list (list  v ) ) ))
65
              ))
66
            e )
67
            (concat p " } "))
68
        )
69
        ((t) ('"?"))))
70
 
71
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.