format is broken

Started by eddier, February 18, 2004, 06:13:16 AM

Previous topic - Next topic

eddier

[code]
(setq data '((1 "a001" "g") (2 "a101" "c") (3 "c220" "g")))
(map (fn (x) (format "%3.2f %5s %2s" (nth 0 x) (nth 1 x) (nth 2 x))) data)
=> ("1.00     g  g" "2.00     c  c" "3.00     g  g")

What happend to the "a001", "a101", and the "c220"?

Eddie

Sammo

#1
Same results on WIN2K, but (format "%3.2f %5s %2s" 1 "a001" "g") produces the correct result as does (map (fn (x) (list (nth 0 x) (nth 1 x) (nth 2 x))) data) ==> ((1 "a001" "g") (2 "a101" "c") (3 "c220" "g"))

eddier

#2
I found that the following works as well.



(map (fn (x) (append (format "%3.2f " (nth 0 x))
                                  (format "%5s " (nth 1 x))
                                  (format "%2s" (nth 2 x))))
  data)




Eddie

Lutz

#3
This bug was introduced in 7.4.5 when taking out the limit of 2048 args in 'format'.



I have fixed this in 7.5.3 which goes up in a couple of minutes into the development directory, but:



CAUTION: in 7.5.3 all deprecated functions are removed as previously announced, look into the chapter 'Deprecated functions', all of these functions have work alikes with different names since many versions, i.e. sublist -> slice etc.. This prompted also changes in cgi.lsp stat.lsp and spam-filter and newlisp-blog and newlisp-wiki.



Lutz

eddier

#4
Thanks Lutz!

Lutz

#5
There are still code changes necessary in the newlisp-tk.tcl code, so the Windows tk version will go up later. At this moment only a Windows executable which will not work with 1.07-tk environment.



Lutz