marshal

2013-07-20

No Description

Upstream URL

github.com/kaiserprogrammer/marshal

Author

Jürgen Bickert <juergenbickert@gmail.com>

Maintainer

Jürgen Bickert <juergenbickert@gmail.com>

License

LGPL, BSD-style
README

1Use Cases

1.1DONEMarshal List

  (fmarshal:load (fmarshal:dump (list 1 (list 2 3) 4)))
  ;; => (1 (2 3) 4)

1.2DONEMarshal Vector

  (fmarshal:load (fmarshal:dump #(1 #(2 3) 4)))
  ;; => #(1 #(2 3) 4)

  (fmarshal:load (fmarshal:dump (make-array (list 2 2) :initial-element 0)))
  ;; => # #2A((0 0) (0 0))

1.3DONEMarshal Hashmap


  (let ((h (make-hash-table :test 'equal)))
    (setf (gethash "blub" h) t)
    (gethash "blub" (fmarshal:load (fmarshal:dump h))))
  ;; => T


1.4DONEMarshal Object

  (defclass test-object ()
    (test-slot))

  (let ((o (make-instance 'test-object)))
    (setf (slot-value o 'test-slot) "blub")
    (slot-value (fmarshal:load (fmarshal:dump o)) 'test-slot))
  ;; => "blub"

1.5DONEMarshal References

  (defclass test-inherited (test-object)
    (object-slot))

  (let ((o (make-instance 'test-inherited)))
    (setf (slot-value o 'test-slot) "blub")
    (setf (slot-value o 'object-slot) o)
    (let ((loaded-object (fmarshal:load (fmarshal:dump o))))
      (values
       (slot-value loaded-object 'test-slot)
       (eq loaded-object (slot-value loaded-object 'object-slot)))))
  ;; => "blub", T

Dependencies (2)

  • closer-mop
  • fiveam

Dependents (0)

    • GitHub
    • Quicklisp