dangrous true?

Started by ssqq, July 27, 2016, 05:32:01 AM

Previous topic - Next topic

ssqq

if you use true? as checking function for list, be attention to: blank list -> '(), would not match it.




> (true? '())
nil



If you often use it, advise you use :



> (define (bool x) (if (nil? x) nil true))
> (for-all bool '(1 2 3 4 () 6))

rickyboy

#1
Quote from: "ssqq"if you use true? as checking function for list, be attention to: blank list -> '(), would not match it.




> (true? '())
nil

`true?` works as advertised.



http://www.newlisp.org/downloads/newlisp_manual.html#truep">http://www.newlisp.org/downloads/newlis ... html#truep">http://www.newlisp.org/downloads/newlisp_manual.html#truep



I don't see any problem with it, and so I don't consider it "dangerous".
(λx. x x) (λx. x x)