Re: (NIL) vs Nothing

2017-02-04 Thread dean
Thank you for your further explanation On 4 February 2017 at 08:29, Alexander Burger wrote: > On Fri, Feb 03, 2017 at 10:04:02PM +0100, pd wrote: > > The reason for this difference is let behaviour: let binds a symbol to a > > value *inside* let expression but first

Re: (NIL) vs Nothing

2017-02-04 Thread Alexander Burger
On Fri, Feb 03, 2017 at 10:04:02PM +0100, pd wrote: > The reason for this difference is let behaviour: let binds a symbol to a > value *inside* let expression but first saves values of binding symbols and > once evaluated the expression it restores previous symbols values saved. > ... Your

Re: (NIL) vs Nothing

2017-02-04 Thread dean
Thank you very much for the explanation. On 3 February 2017 at 21:04, pd wrote: > The reason for this difference is let behaviour: let binds a symbol to a > value *inside* let expression but first saves values of binding symbols and > once evaluated the expression it

Re: (NIL) vs Nothing

2017-02-03 Thread pd
The reason for this difference is let behaviour: let binds a symbol to a value *inside* let expression but first saves values of binding symbols and once evaluated the expression it restores previous symbols values saved. So, when you wrap a expression in a let binding you are protecting the

Re: (NIL) vs Nothing

2017-02-02 Thread dean
Just to illustrate what I meant... : (let X 0 (for Y 3 (let X (inc 'X) (prinl X 1 1 1 -> 1 On 2 February 2017 at 18:16, dean wrote: > Thank you very much for the adviceI've just used that and it's worked > a treat > > : (let X 0 > (for Y 3 >

Re: (NIL) vs Nothing

2017-02-02 Thread dean
Thank you very much for the adviceI've just used that and it's worked a treat : (let X 0 (for Y 3 (inc 'X) (prinl X))) 1 2 3 -> 3 I did try my first example with lets instead of setqs but the second let kept looking at the first let value precluding any

Re: (NIL) vs Nothing

2017-02-02 Thread pd
I think this is not the use you intent In *my* opinion: On Thu, Feb 2, 2017 at 3:44 PM, dean wrote: > >(setq Ln_no 0) >(in Epic_txt_fl_pth > (until (eof) > (setq Ln_no (inc 'Ln_no) ) > this is redudant since you're simply incrementing the value

Re: (NIL) vs Nothing

2017-02-01 Thread dean
Thank you for your insight that contradicts and clarifies numerous of my misconceptions. That's exactly what I needed. Best Regards Dean On 1 February 2017 at 08:20, Alexander Burger wrote: > He Dean, > > > I've "proved" that a let statement's result is visible ANYWHERE

Re: (NIL) vs Nothing

2017-01-31 Thread dean
After playing around with some test programs ...I think I've got most of that now. I've "proved" that a let statement's result is visible ANYWHERE within it's bounding parens but not outside of them and If we have (do something to X) (do something to Y) (do something to X again) I was hoping

Re: (NIL) vs Nothing

2017-01-31 Thread dean
> This *might* be what you need. I can't test it. That's fine. Your comments are EXTREMELY helpful because as you correctly note I am struggling with this. I still don't understand some of things you mention so please bear with me and I'll try narrow down the source of my misunderstanding. Thank

Re: (NIL) vs Nothing

2017-01-31 Thread Alexander Burger
On Tue, Jan 31, 2017 at 07:14:57PM +0100, Alexander Burger wrote: > The only place where it is good is the line (setq Ln (pack " " Ln)). For the > rest all 'setq's can be simply omitted if you fix the conditional flow. > > Try it! :) OK, could not resist ;) This *might* be what you need. I

Re: (NIL) vs Nothing

2017-01-31 Thread Alexander Burger
Hi Dean, I see a lot of confusion about 'let' and perhaps also 'setq'. I don't know how to better explain it as it is already done in the function references. So I just put a few comments here; please try to understand how exactly these functions work! >(dm ln_completes> (Ln Ln_no) >

Re: (NIL) vs Nothing

2017-01-31 Thread dean
Here's the original "setq" method (dm ln_completes> (Ln Ln_no) (if (gt0 (: first_ln_no)) (setq Ln (pack " " Ln))) (if (<> (: new_buf) NIL) (=: buf (: new_buf)) (=: buf (: hdngs))) (if (member Ln (: buf)) (prog

Re: (NIL) vs Nothing

2017-01-31 Thread dean
I've inadvertently pressed some send key combo again... simple use of let is fine e.g. (let X 3 do what ever you want to do with X here without much change of hierachy ) Ln doesn't fit this usage pattern and to "let" it be something at the top seems somewhat artificial because there's an if

Re: (NIL) vs Nothing

2017-01-31 Thread dean
Any help advising how I should restructure the parens in order to replace setq with let would really help me to understand how to do it. Thank you in anticipation and sorry if this is a really easy thing to do. On 31 January 2017 at 16:32, dean wrote: > I've

Re: (NIL) vs Nothing

2017-01-31 Thread dean
Oops acccidentally sent before I finished...Sorry! I was going to say the examples I've seen tend to be (let X 3 (dm ln_completes> (Ln Ln_no) (let (Ln Ln Res 0) (if (gt0 (: first_ln_no)) (let Ln (pack " " Ln))) (if (<> (: new_buf) NIL)

Re: (NIL) vs Nothing

2017-01-31 Thread dean
Each one of the "let"s in the following method WAS a setq. All I did was wrap the existing body with parens and assign Ln and Res with "let" but it doesn't work. The examples I've seen tend to be like this... (let X 3 ) ) On 30 January 2017 at 16:19, dean wrote:

Re: (NIL) vs Nothing

2017-01-30 Thread dean
Hi Alex Yes that worked great preceded by a testi.e. whizzing through all file lines in the input file until almost the 4000th which triggered reporting on the method of interests's input and output. Thank you very much for the advice. Best Regards Dean On 30 January 2017 at 11:07, Alexander

Re: (NIL) vs Nothing

2017-01-30 Thread Alexander Burger
Hi Dean, > trace operates in debug mode but again am not exactly sure how to ensure > that I am in debug mode on a method (rather than a function which is just > (debug 'Fn) at that point. > I have tried but get can't trace. While (trace 'foo) traces a function, (trace 'meth> '+Class) traces a

Re: (NIL) vs Nothing

2017-01-30 Thread dean
I'm applying a method mthd> *Obj to each line of a file in turn. I've tracked a problem down to when that method operates on line 3738 but am unsure of exactly how to trace the method from that point on. I see that trace operates in debug mode but again am not exactly sure how to ensure that I

Re: (NIL) vs Nothing

2017-01-29 Thread dean
I've just tried sprinkling (!) in my source. That is going to help me A LOT. It looks like the PL equivalent of int 3 :)

Re: (NIL) vs Nothing

2017-01-29 Thread dean
Hi Alex Thank you for the adviceI've just this minute used debug by coincidence...but not with breakpoint and I've never used trace. so thank you for those and also for putting me straight re the positioning and syntax of (let (A 1 B 2.. Please have a good rest of the weekend. Best Regards

Re: (NIL) vs Nothing

2017-01-29 Thread Alexander Burger
Hi Dean, > I'm tending to develop functions in isolation so I can watch them like a > hawk. Watching like a hawk is always good! ;) In addition to that, I would recommend to use 'trace' and 'debug'. Especially 'trace' is more useful than it may seem, letting you monitor your whole program's

Re: (NIL) vs Nothing

2017-01-29 Thread dean
If we take objects as an example...You might want to use these to create static variables using object properties which you want to persist within a limited scope. You might setq the object itself to make it persist but do you manipulate the objects properties (that you want to persist) using setq

Re: (NIL) vs Nothing

2017-01-29 Thread dean
Hi Chrostophe and Alex Thank you very much for your adviceIt is very timely. I'm only too aware of the dangers of using setq, having been bitten a few times now by interference between functions in my whole program. I'm tending to develop functions in isolation so I can watch them like a

Re: (NIL) vs Nothing

2017-01-28 Thread Alexander Burger
Hi Christophe, > > (de fltr (Buf Ln) > >(setq New_buf (mapcar '((Ele) (pack (tail (- (length Ln)) (chop Ele > > (filter '((Ele) (pre? Ln Ele)) Buf > > I'm not an expert, I just want to warn and maybe be confirmed. > As Alex said recently, PicoLisp programs should rarely use

Re: (NIL) vs Nothing

2017-01-28 Thread Christophe Gragnic
Hi all, On Fri, Jan 27, 2017 at 7:01 PM, dean wrote: > I've got this filtering function > > (de fltr (Buf Ln) >(setq New_buf (mapcar '((Ele) (pack (tail (- (length Ln)) (chop Ele > (filter '((Ele) (pre? Ln Ele)) Buf I'm not an expert, I just want

Re: (NIL) vs Nothing

2017-01-28 Thread dean
That' greatthank you for both examples. On 27 January 2017 at 19:03, Alexander Burger wrote: > Hi Dean, > > > (de fltr (Buf Ln) > >(setq New_buf (mapcar '((Ele) (pack (tail (- (length Ln)) (chop > Ele > > (filter '((Ele) (pre? Ln Ele)) Buf > > ... > >

Re: (NIL) vs Nothing

2017-01-27 Thread Alexander Burger
Hi Dean, > (de fltr (Buf Ln) >(setq New_buf (mapcar '((Ele) (pack (tail (- (length Ln)) (chop Ele > (filter '((Ele) (pre? Ln Ele)) Buf > ... > #: (fltr '(aa ab) 'ab) > #-> (NIL) You can use 'extract' to get exactly the results you need: (de fltr (Buf Ln) (let N (inc

re (NIL) vs nothing

2017-01-27 Thread dean
re my last post/thread I don't want to waste anyone's time so please hold fire... I've split the filtering and chopping in two and even the filtered member LIst is disappearing (as a result of just filtering (when it shouldn't) so the problem doesn't look like it's to do with chopping the values