Object serialization: Difference between revisions

Content added Content deleted
(→‎{{header|OCaml}}: link to the module Marshal)
Line 1,717: Line 1,717:
(2 . second)
(2 . second)
(3 . "-th-")))
(3 . "-th-")))
{(4 . 'sym) ; alternatively declared..
(5 . +)} ; ..associative array
#false ; value
#false ; value
-123 ; short number
-123 ; short number
Line 1,722: Line 1,724:
)
)
;; Defined Object
;; Defined Object
#[(1 2 3 4) #u8(4 3 2 1) hello こんにちは #((1 . 123456) (2 . second) (3 . -th-)) #false -123 123456789012345678901234567890123456789]
#((1 2 3 4) #(4 3 2 1) hello こんにちは #ff((1 . 123456) (2 . second) (3 . -th-))
#ff((4 . sym) (5 . #<function>)) #false -123
123456789012345678901234567890123456789)


> (fasl-save Object "/tmp/object.bin")
> (fasl-save Object "/tmp/object.bin")
Line 1,729: Line 1,733:
> (define New (fasl-load "/tmp/object.bin" #false))
> (define New (fasl-load "/tmp/object.bin" #false))
;; Defined New
;; Defined New
#[(1 2 3 4) #u8(4 3 2 1) hello こんにちは #((1 . 123456) (2 . second) (3 . -th-)) #false -123 123456789012345678901234567890123456789]
#((1 2 3 4) #(4 3 2 1) hello こんにちは #ff((1 . 123456) (2 . second) (3 . -th-))
#ff((4 . sym) (5 . #<function>)) #false -123
123456789012345678901234567890123456789)


> (equal? Object New)
> (equal? Object New)