newLISP Fan Club

Forum => newLISP in the real world => Topic started by: newdep on June 02, 2005, 01:37:33 PM

Title: save versus load
Post by: newdep on June 02, 2005, 01:37:33 PM
Hi Lutz,



when I save with 'save this is the result in that file ->



(set 'data '(49 79 45 76 64 58 4e 79 4c 32 4a 70 62 69 39 75 5a 58 64 73 61 58 4e  

  77 43 6a 73 37 49 47 56 34 59 57 31 77 62 47 55 67 64 47 56 34 64 41 6f 6f 63 48

  4a 70 62 6e 52 73 62 69 41 69 58 47 35 63 63 6c 52 49 53 56 4d 67 53 56 4d 67 52

  56 68 46 51 31 56 55 52 55 51 67 52 6c 4a 50 54 53 42 58 53 56 52 49 53 55 34 67

  54 6b 56 58 54 45 6c 54 55 43 46 63 62 6c 78 79 49 69 6b 4b 4b 47 56 34 61 58 51

  70 43 67 3d 3d))





If I then go on the newlisp prompt and do ->

>(load "test")



Then this is the output -->



> (load "test")

true

> data

(49 79 45 76 64 58 4 e 79 4 c 32 4 a 70 62 69 39 75 5 a 58 64 73

 61 58 4 e 77 43 6 a 73 37 49 47 56 34 59 57 31 77 62 47 55 67 64

 47 56 34 64 41 6 f 6 f 63 48 4 a 70 62 6 e 52 73 62 69 41 69 58

 47 35 63 63 6 c 52 49 53 56 4 d 67 53 56 4 d 67 52 56 68 46 51 31

 56 55 52 55 51 67 52 6 c 4 a 50 54 53 42 58 53 56 52 49 53 55 34

 67 54 6 b 56 58 54 45 6 c 54 55 43 46 63 62 6 c 78 79 49 69 6 b

 4 b 4 b 47 56 34 61 58 51 70 43 67 3 d 3 d)





Do you see the difference? 'Load does manipulate the data list !!



How come? I thought it was a one on one copy?



Regards, Norman...
Title:
Post by: newdep on June 02, 2005, 01:45:47 PM
another example ->



--- file t1 contains this ->

(set 'a '( 1a 1b 1c 1d 1e 1f ))

(set 'b '( aa bb cc dd ee ff ))

(set 'c '( a1 b1 c1 d1 e1 f1 ))

(set 'd '( 1A 1B 1C 1D 1E 1F ))





> (load "t1")

true

> a

(1 a 1 b 1 c 1 d 1 e 1 f)

> b

(aa bb cc dd ee ff)

> c

(a1 b1 c1 d1 e1 f1)

> d

(1 A 1 B 1 C 1 D 1 E 1 F)

>



This means i can never use HEX numbers in a list and 'load it...



So it seems that LOAD does eveluate because its not a string that

is inside the list. Oke fine.. But how to bypass this? Its much more

work to (read-file  t1) evaluate it and but it inside to code.. thats why

i tried 'load.. Mmmmmmm
Title:
Post by: newdep on June 02, 2005, 01:56:02 PM
actualy... (read-file) and (read-buffer) convert to string data..

I like/need the way Load handles the data..that 100% newlisp interaction..
Title:
Post by: newdep on June 02, 2005, 01:57:48 PM
oke !!! got it !



Ill just save as one big string inside a list..!

That should do the trick..
Title:
Post by: Lutz on June 02, 2005, 02:02:45 PM
1a 3b etc will be parsed as 1 a 3 b etc. thats just how the syntax parse rules work.



Do your (set 'data '(...)) in an intecative window to see:

> (set 'data '(3a 4b 8f))
(3 a 4 b 8 f)
>


Instead put this in your file, when you deal with hex values

(set 'data '(0x3a 0x4b 0x8f))


Lutz
Title:
Post by: newdep on June 02, 2005, 02:14:45 PM
You know what I like about newlisp!?



Its so addictive that I cant leave my fingers from trying more than

one solution ;-)



Thanks!



Norman.