<aw->
i noticed programs executed with (call) inherit the environment, ex: env variables defined with (sys), is this by design, or is that specific to my terminal?
orivej has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 250 seconds]
razzy has quit [Ping timeout: 244 seconds]
freemint has joined #picolisp
<freemint>
Good Morning
orivej has joined #picolisp
<Regenaxer>
Hi freemint
<Regenaxer>
Hi aw-
<beneroth>
aw-, to my understanding this is by design, as (call) creates a child process - normal POSIX behaviour
<beneroth>
Hi freemint
<beneroth>
Hi Regenaxer, aw- :)
<Regenaxer>
Hi beneroth :)
<beneroth>
Regenaxer, correct?
<Regenaxer>
Yep
<Regenaxer>
'call' does nothing special with the env vars
<aw->
hi freemint, beneroth
<aw->
ok thanks
<aw->
is there a way to obtain the entire list of key/values from (rc) ?
<beneroth>
(in "thefile" (rd)) I would assume...
<Regenaxer>
IIRC it is plain text, so (read)
<Regenaxer>
it is an assoc list
<Regenaxer>
: (in "a.rc" (echo)) # Display it
<Regenaxer>
((c . b) (b 2 3 4) (a . 1))
freemint has quit [Ping timeout: 268 seconds]
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
_whitelogger has joined #picolisp
ubLIX has joined #picolisp
orivej has quit [Ping timeout: 255 seconds]
orivej has joined #picolisp
<aw->
hmmm
<aw->
not display
<aw->
i want to use the list
<aw->
like (setq *Myvar (in "a.rc ...
<aw->
ohhh it's JUST a list
<aw->
i thought it had a special format
<aw->
(read) should work
<Regenaxer>
Yes, a single list
<Regenaxer>
The (echo) is just the simplest way to view the file contents
<aw->
this is good
<aw->
so simple
razzy has joined #picolisp
orivej has quit [Ping timeout: 245 seconds]
ubLX has joined #picolisp
ubLIX has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
orivej has quit [Remote host closed the connection]
orivej has joined #picolisp
razzy` has joined #picolisp
razzy` has quit [Client Quit]
freemint has joined #picolisp
ubLX has quit [Quit: ubLX]
freemint has quit [Ping timeout: 268 seconds]
freemint has joined #picolisp
orivej has quit [Ping timeout: 250 seconds]
freemint has quit [Ping timeout: 245 seconds]
freemint has joined #picolisp
<rick42>
hello pil peeps
<beneroth>
hello rick42 peep
<rick42>
question: if i `(setq L (1 2 3 4))` then `(setq L2 L)`, are `L` and `L2` pointing to the same list (in memory), i.e. data "sharing"?
<rick42>
ah, there is an address operator! thanks, tankf33der!
<rick42>
I had wanted to *see* about passing arguments, that call by value was *not* happening:
<rick42>
-> f
<rick42>
: (de f (Lf) (== L Lf))
<rick42>
-> T
<rick42>
: (f L)
<rick42>
I was writing this when tankfeeder gave me the clue bat, so another way:
<rick42>
: (de f2 (Lf) (adr Lf))
<rick42>
-> f2
<rick42>
: (adr L)
<rick42>
-> 2147940219
<rick42>
: (f2 L)
<rick42>
-> 2147940219
<Regenaxer>
rick42, why did you expect that call by value would not happen?
<rick42>
All this started for me when I re-read an old ML message wherein Regenaxer said "cut does not modify the list in any way. Only the variable which points to the list is modified." I thought "that's neat, but most (all?) other lisps I've seen don't do this" iirc.
<rick42>
Regenaxer: i meant to say that pil does not pass a copy
<rick42>
of the value
<Regenaxer>
Well, 'cut' (like 'pop') is call by reference
<Regenaxer>
as you pass the *variable* pointing to the list
<rick42>
yes
<Regenaxer>
only the value of that var is modified
<rick42>
*that var* yes
<Regenaxer>
Other Lisps have 'pop' too
<Regenaxer>
Probably as a macro
<Regenaxer>
'cut' is an extended 'pop' ;)
freemint has quit [Ping timeout: 268 seconds]
<rick42>
:)
<Regenaxer>
In fact I never really thought about it
<Regenaxer>
call by value or whatever
<Regenaxer>
it can be anything, but call by value is probably the right term
<Regenaxer>
the value might be a 'var', so it becomes "by reference" perhaps
<rick42>
Not the argument passing thing, but the assignment semantics, here is another lisp -- this is very different from picolisp:
<rick42>
> (setq L '(1 2 3 4))
<rick42>
(1 2 3 4)
<rick42>
(1 2 3 4)
<rick42>
> (setq L2 L)
<rick42>
> (address L) (address L2)
<rick42>
34368997152
<rick42>
34368996992
<rick42>
Regenaxer: pl I will read that. thanks!
<rick42>
pl = ok :)
<Regenaxer>
Oh, strange. So this lisp indeed copies the list in the second assignment?
<rick42>
T
<Regenaxer>
Quite wasteful
<Regenaxer>
What if you 'rplaca' one list?
<rick42>
seems like something that should be explicity called for
<Regenaxer>
(corresponds to 'set' in pil)
<Regenaxer>
yes
<Regenaxer>
or 'address' above is something different
<rick42>
afaik `address` in this lisp is the analog to `adr` in pil
<Regenaxer>
Perhaps it builds some invisible internal structures
<Regenaxer>
the lists themselves might be identical
<rick42>
huh didn't think of that
<Regenaxer>
Does 'rplaca' or similar exist?
<rick42>
let me check
<Regenaxer>
yes, some wrapper
<Regenaxer>
(replaca L 7)
<Regenaxer>
Then look if L2 is modified too
<rick42>
> (setf (L 0) 7)
<rick42>
> L
<rick42>
(7 2 3 4)
<rick42>
7
<rick42>
> L2
<rick42>
(1 2 3 4)
<beneroth>
sounds like "following purist functional global immutability"
<Regenaxer>
Indeed different
<rick42>
lol
<Regenaxer>
yes
<beneroth>
rick42, that lisp has threads, I assume? :P
<rick42>
i'm not sure
<rick42>
hehehe
<Regenaxer>
Even with threads such side effects are desirable
<Regenaxer>
user can always (copy L) himself
<rick42>
right
<Regenaxer>
What if the list has a million cells, and is iterated in a loop? :D
<beneroth>
in a way it's pretty ironic - threads are (afaik) processes with shared memories (unlike real separate processes), the main gain of them is the sharing of memory - and then so many languages hop through many loops to work around the "shared memory" again.
<rick42>
Regenaxer: inorite
<Regenaxer>
beneroth, exactly
<beneroth>
people apparently just don't like semaphores - or they are to complicated for average programmer, or so...
<rick42>
at least clojure has a shared data scheme under the hood
<Regenaxer>
I see
<beneroth>
because it's JVM under the hood
<beneroth>
ah you mean, deduplicated data
<beneroth>
well ok, that's something
<rick42>
no because they programmed it that way
<rick42>
beneroth: yes
<beneroth>
but yeah, general overhead all the time
<Regenaxer>
I think in pil the only copying functions are 'copy' and 'append'
<beneroth>
in effect: less control for programmer. so standard optimizations can/do take place - which might be good or bad, depending on the actual situation :)
<Regenaxer>
'delete' too
<beneroth>
link ?
<Regenaxer>
maybe more
<Regenaxer>
link to?
<beneroth>
hm..no right, link is not copying.
<Regenaxer>
ah
<Regenaxer>
no
<Regenaxer>
it is destructive
<Regenaxer>
like 'conc', but to the internal 'make' list
<beneroth>
getl ?
<Regenaxer>
getl makes a new list
<beneroth>
so copying :)
<Regenaxer>
not in this sense
<beneroth>
not deep copy
<beneroth>
aye
<Regenaxer>
of copying a list of cells
<Regenaxer>
Most functions make new lists
<Regenaxer>
mapcar etc.
<Regenaxer>
Reading
<Regenaxer>
Ah, 'replace' copies too
<Regenaxer>
and the others mentioned in that ref: append, delete, insert, remove and place
<Regenaxer>
So there are quite a few
<Regenaxer>
'append' versus 'conc' is the most typical case
<Regenaxer>
of destructive vs. non-destructive (= immutable)
orivej has joined #picolisp
<rick42>
is there a chart/table of these in reference docs or on the website? curious
<rick42>
(not super important)
<Regenaxer>
I'm afraid not
<rick42>
ok
<Regenaxer>
not a systematic one
<rick42>
i guess the reponse could have been: "if so, than what would be the fun in learning?" :D
<Regenaxer>
indeed :)
<Regenaxer>
I think most stuff in pil is non-destructive
<Regenaxer>
so the destructive functions are all marked as this in the ref (I hope)
freemint has joined #picolisp
alexshendi has joined #picolisp
<rick42>
thanks!
<Regenaxer>
☺
<beneroth>
such a table/matrix would be useful, I think. could be a wiki article, at least :)
<beneroth>
afk
<Regenaxer>
T
<razzy>
Regenaxer: you have said that most functions make new list. do they make new copy in memory of all cells? or you just copy least adresses possible. (i do not know, if i am wording correctly.)
<Regenaxer>
Yes, correct. Only copies the necessary cells