<abu[m]>
And because L is circular, it repeats after a while
<abu[m]>
4 2 4 2 4 6 2 6 .) is added infinitely
<abu[m]>
because (++ L) always "pop"s the next value from L
<anddam>
I figure the "odd" way that list is defined is what makes it circular
<abu[m]>
yes
<abu[m]>
(a b c .) is a 3-cell circular list
<abu[m]>
reader syntax
<anddam>
I remember reading the reference once, it had something about it
<anddam>
oh there it is "PicoLisp has built-in support for reading and printing simple circular lists. If the dot in a dotted-pair notation is immediately followed by a closing parenthesis, it indicates that the CDR of the last cell points back to the beginning of that list"
<abu[m]>
ah, yes
<anddam>
so the list has a warm-up of 1 . 2 . 2 then a circular part
<abu[m]>
yep
<abu[m]>
So the dot in the middle is needed
<abu[m]>
to get the starting cell
<anddam>
to split the "run once" from the circular part
<abu[m]>
very good!
<anddam>
I scratching a bit my head about the (and)
<abu[m]>
The 'and' is quite standard Lisp I think
<anddam>
I know lisp as much as I know picolisp
<abu[m]>
oh, I see
<anddam>
(while 'any . prg) 'any is the two expressions (>=) and (and) right?
<abu[m]>
You could write (when (and (prime? D) (apply < ...)) (link ...))
<anddam>
i.e. prg is last arguments passed to while
<abu[m]>
The prg is the and here
<abu[m]>
'any' is (>= ... D)
<anddam>
parenthesis don't match, or so it seems to me
<anddam>
(link D) ) is closing (and
<anddam>
but prg is last element before closing (while
<anddam>
and that should be (inc 'D (++ L)) )
<anddam>
is that wrong?
<abu[m]>
'prg' is (and ) and (inc ...)
<anddam>
two sibling forms?
<abu[m]>
You could check the indentation, it is correctly indented
<abu[m]>
A prg is a list of exe's
<abu[m]>
one exe is (and ) and one is (inc )
<abu[m]>
(while (>= )
<abu[m]>
(and ...)
<abu[m]>
(inc ...) )
<anddam>
why is prg a list of exe in (while 'any . prg) and 'any is not?
<anddam>
due to the quoting?
<abu[m]>
The quoting indicates that 'any' is evaluated (though the exe's in prg may also get evaluated)
<abu[m]>
while evaluate the any
<abu[m]>
and if non-NIL, it runs 'prg' and loops back
<abu[m]>
The goal is the 'link'
<abu[m]>
it links D if it is prime and has ascending digits
<anddam>
so it checks it's prime, check it's split digits are in increasing order and if so (chain in the and form) links it to D
<abu[m]>
yes, but not "links to D". It "links D"
<abu[m]>
i.e. puts it into the result
<anddam>
oh, right
<anddam>
I just read the function
<anddam>
"in the current *make* environment"
<anddam>
so D is the argument, not the destination
<abu[m]>
yeah
<anddam>
the environment will get returned at the end of the (make) evaluation
<anddam>
I guess
<abu[m]>
the destination is implicit
<anddam>
it _almost_ makes sense
<abu[m]>
exactly
<anddam>
two things unclear
<anddam>
one is re: Knuth's algo
<anddam>
why are the increase steps fixed at those numbers
<anddam>
the other is about that while definition (while 'any . prg) why does prg get to be a list of exe and not any
<abu[m]>
It is in Vol. 2 of Knuth Art of Computer programming
<anddam>
I have recently started SICP
<anddam>
I have a long list of stuff to read (yet), a full time job, and a toddler…
<abu[m]>
ok, I have it downstairs, but iirc it is "factoring into primes"
<anddam>
I guess I won't educate myself in CS before retirement
<abu[m]>
no need! :)
<anddam>
but it's fun
<abu[m]>
You are right with the prg
<anddam>
duly noted about the AoCP reference
<abu[m]>
cause an exe *is* an any
<abu[m]>
and exe is a number, a symbol or a list
<abu[m]>
But the meaning is on "execution", the evaluation aspect
<abu[m]>
So a 'prg' is a list of 'exe's which are 'any's ☺
<abu[m]>
The point is that it is a list
<abu[m]>
(including NIL as an empty list)
<abu[m]>
The formatted output comes from the 'tab' call BTW