This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
> (transpose '((1) (1 2)))
((1 1))
> (transpose (transpose '((1) (1 2))))
((1) (1))
> (transpose (transpose '((1 nil) (1 2))))
((1 nil) (1 2))
- thank you! Hope that QA-tests is up to date.Downloads for an upcoming 10.7.5 later this spring:Quote from: "Lutz"http://www.newlisp.org/downloads1075/">http://www.newlisp.org/downloads1075/
Thanks for the discovery of this bug.Quote from: "Lutz"
Fixed here:http://newlisp.nfshost.com/downloads/development/inprogress/"> http://newlisp.nfshost.com/downloads/de ... nprogress/">http://newlisp.nfshost.com/downloads/development/inprogress/
(letn (L '((1 2 3) (1 2 ))) (= L (transpose (transpose L)))) -> nil
newLISP v.10.7.1 32-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h
> (= '(true) '(true nil))
nil
> (= '(true nil) '(true))
true
> (= '(1 0) '(1)) #-> true?
nil
>
newLISP v.10.7.1 32-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h
# (WindowsXP)
> (setq R '()) (time (push (dump x) R -1) 10 )(map unique (transpose R))
((5249584) (256) (5243024) (5243024) (5243024))
(setq R '()) (time (push (dump x) R -1) 100000000 ) (map unique (transpose R))
()
ERR: not enough memory in function dump
> (delete 'x) # more than minute for evaluation
true
> # still 2Gb RAM
> (reset)
> # no effect
> (symbols)
ERR: not enough memory in function symbols
> (dotree (s MAIN) (delete s true))
ERR: not enough memory
> (sys-info)
ERR: not enough memory
> (delete 'x) # try again
ERR: not enough memory
> (exit)
ERR: not enough memory
> (setq R '()) (time (push (dump x) R -1) 100000000 ) (map unique (transpose R))
()
ERR: not enough memory in function dump
> (delete 'R) (reset)
> (setq R '()) (time (push (dump x) R -1) 100000000 ) (map unique (transpose R))
(setq LOG '() row '() ) ; whole tracelog and one variable for trace REPL once
;; As I understand interpretation process, when I type a str-IN and press ENTER,
;; 1. command-event catch str-IN and can returns empty string to stop interpretation in usual way.
(command-event
(fn (str-IN)
(setq CE-timestamp (date (date-value) 0 "%x %X"))
(println (list {command-event} CE-timestamp str-IN))
(setq row '())
(setq row (append row (list CE-timestamp str-IN)))
str-IN
))
;; 2. Internally calls (read-expr str-IN) it produce expr-CMD, or nothing in case of comment or empty string.
;; 3. reader-event takes expr-CMD, it "can do transformation on the expression before it gets evaluated"
;; and can stop evaluation process by returning nil. It returns (modifyed) expr-CMD.
(reader-event
(fn (expr-CMD)
(setq RE-timestamp (date (date-value) 0 "%x %X"))
(println (list {reader-event} RE-timestamp expr-CMD))
(setq row (append row (list RE-timestamp expr-CMD) ))
expr-CMD
))
;; 4. Internally calls (eval expr-CMD) -> expr-RESULT.
;; 5. Internally calls (string expr-RESULT) -> str-OUT.
;; 6. Internally calls (print str-OUT) - it show these string according to pretty-print settings.
;; 7. prompt-event calls to show prompt to signal Human that transmission is over.
(prompt-event
(fn (ctx) ; manual: "The current context before calling the prompt-event code is passed as a parameter to the function."
(setq PE-timestamp (date (date-value) 0 "%x %X"))
(setq row (append row (list PE-timestamp ctx)))
(println (list {prompt-event} PE-timestamp ctx))
(println {Complete trace of command- reader- prompt- events: } row)
(push row LOG -1) ; наконец, добавляем это всё в копимый LOG
(string ctx ":" (real-path) "$ ") ; return special prompt
))
;; now your move, Human
MAIN:r:binemacs-25.2-i686bin$ (+1 1)
("command-event" "2019.03.30 14:14:51" "(+1 1)n")
("reader-event" "2019.03.30 14:14:51" (1 1))
ERR: illegal parameter type : 1
("prompt-event" "2019.03.30 14:14:51" MAIN)
Complete trace of command- reader- prompt- events: ("2019.03.30 14:14:51" "(+1 1)n" "2019.03.30 14:14:51" (1 1) "2019.03.30 14:14:51" MAIN)
MAIN:r:binemacs-25.2-i686bin$ row
("command-event" "2019.03.30 14:14:56" "rown")
("reader-event" "2019.03.30 14:14:56" row)
("2019.03.30 14:14:56" "rown" "2019.03.30 14:14:56" row)
("prompt-event" "2019.03.30 14:14:56" MAIN)
Complete trace of command- reader- prompt- events: ("2019.03.30 14:14:56" "rown" "2019.03.30 14:14:56" row "2019.03.30 14:14:56" MAIN)
MAIN:r:binemacs-25.2-i686bin$ LOG
("command-event" "2019.03.30 14:15:00" "LOGn")
("reader-event" "2019.03.30 14:15:00" LOG)
(("2019.03.30 14:14:44" "(setq LOG '())n" "2019.03.30 14:14:44" (setq LOG '()) "2019.03.30 14:14:44" MAIN) ("2019.03.30 14:14:51" "(+1 1)n" "2019.03.30 14:14:51" (1 1) "2019.03.30 14:14:51" MAIN) ("2019.03.30 14:14:56"
"rown" "2019.03.30 14:14:56" row "2019.03.30 14:14:56" MAIN))
("prompt-event" "2019.03.30 14:15:00" MAIN)
Complete trace of command- reader- prompt- events: ("2019.03.30 14:15:00" "LOGn" "2019.03.30 14:15:00" LOG "2019.03.30 14:15:00" MAIN)
MAIN:r:binemacs-25.2-i686bin$
Two days out of luck.Quote from: "IVShilov"
(define (utf? str) (= (length str) (utf8len str)))
There is no built-in function that I know of that can return the type of any newLISP expression. At best, you may be able to construct your own function that uses the existing predicate functions to return a string that is unique for each cell type.Quote from: "ryuo"
(define (type x)
(let (types
'("bool" "bool" "integer" "float"
"string" "symbol" "context" "primitive"
"import-simple" "import-libffi" "quote" "list" "lambda"
"fexpr" "array"))
(types (& 0xf ((dump x) 1)))))
(lambda? lambda?) -> nil
Quote from: "oofoe"
Any possibility of getting the "(import LIBRARY)" syntax in Windows too? With maybe some way to list the symbols in the library?
(libiconv_open "cp866" "utf-8")
newLISP v.10.7.1 64-bit on Windows IPv4/6 UTF-8 libffi, options: newlisp -h
> (rotate (sequence 0 24) -25 ) # BUG:
(0)
> (rotate (sequence 0 24) -24 ) # all OK:
(24 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23)
> (rotate (sequence 0 24) -26 ) # all OK again:
(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 0)
> (letn (x 25) (rotate (sequence 0 x) (- (inc x)) )) # again all OK, but must be BUG:
(26 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25)
> (rotate (sequence 0 4) -5 ) # BUG:
(0)
> (rotate (sequence 0 5) -6 ) # BUG:
(0)
>
> (exec "chcp") # get current code page
("Active code page: 866")
> (exec "chcp 1251") # change code page to CP1251
("Active code page: 1251")
>
(prompt-event
(fn (ctx)
(string
(last (parse (first (exec "chcp")) { }))
{ > })))
$prompt-event
1251 > # now for debugging we see chcp in prompt
1251 > (reader-event (lambda (ex) (println "reader-event IN: " ex)))
=> (reader-event (lambda (ex) (println "reader-event IN: " ex)))
$reader-event
1251 > (char "Ё")
reader-event IN: (char "Ё")
168
1251 > (command-event (fn (s)(println {command-event IN:} s) s))
reader-event IN: (command-event (lambda (s) (println "command-event IN:" s) s))
$command-event
1251 >
65001 > (println (char 937))
command-event IN:(println (char 937))
reader-event IN: (println (char 937))
Ω
"Ω"
65001 > (println "Ω")
command-event IN:(println
ERR: missing parenthesis : "...(println"
65001 >
1251 > (println (char 937))
command-event IN:(println (char 937))
reader-event IN: (println (char 937))
О©
"О©"
1251 > (print "Ω")
command-event IN:(print "?")
reader-event IN: (print "?")
?"?"
1251 >