ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Check also http://www.picolisp.com for more information
orivej has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
casaca has quit [Ping timeout: 256 seconds]
ym has quit [Ping timeout: 256 seconds]
ym has joined #picolisp
_whitelogger has joined #picolisp
_whitelogger has joined #picolisp
_whitelogger has joined #picolisp
casaca has joined #picolisp
orivej has quit [Ping timeout: 246 seconds]
Blukunfando has quit [Ping timeout: 256 seconds]
_whitelogger has joined #picolisp
Blukunfando has joined #picolisp
pointfree has quit [Quit: Connection closed for inactivity]
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
Seteeri has joined #picolisp
aw- has joined #picolisp
<aw-> hi
<aw-> Regenaxer: sorry I keep missing the pilcon chats
<aw-> the timing is not good tbh
<aw-> Saturday is the busiest time, it's not part of my "work time", so difficult to sit at the computer for a video chat
radiator3434 has joined #picolisp
<aw-> i think the ultimate solution would be if you can record something once a month
<aw-> and then we can respond/discuss in IRC or on the mailing list
<aw-> i don't think "Live" with people in 8 different timezones is very feasible
<aw-> there's always someone who can't make it
<aw-> but i don't want to put pressure on you to do all that work
<aw-> on that note, bonne nuit ;)
radiator3434 has left #picolisp [#picolisp]
radiator3434 has joined #picolisp
<radiator3434> Hello, question: if L is (1 A 2 B 3 C 4 D) how can you loop over it by consecutive pairs, i.e. first get (1 . A) then (2 . B) etc?
<Seteeri> (for (L '(1 A 2 B 3 C 4 D) L (cddr L)) (println (head 2 L)))
<Seteeri> on each iteration, L will be set to the cddr of the current L
<Seteeri> to specifically get a pair: (for (L '(1 A 2 B 3 C 4 D) L (cddr L))
<Seteeri> (let ((A B) (head 2 L)) (println (cons A B))))
<Seteeri> whoops, forgot a newline: (for (L '(1 A 2 B 3 C 4 D) L (cddr L)) (let ((A B) (head 2 L)) (println (cons A B))))
<Seteeri> simpler: (for (L '(1 A 2 B 3 C 4 D) L (cddr L)) (let ((A B) L) (println (cons A B))))
<Seteeri> without let: (for (L '(1 A 2 B 3 C 4 D) L (cddr L)) (println (cons (car L) (cadr L))))
<radiator3434> which of the three forms of "for" is that?
<Seteeri> the third (last)
<Regenaxer> Hi aw-! Indeed, it is difficult to find good points in time
<radiator3434> thanks
<Regenaxer> beneroth also could not attend
<Regenaxer> Perhaps we should discuss once more in the mailing list
<Seteeri> np
mmmattyx has joined #picolisp
<Regenaxer> I would also go with (for (L ... (cddr L)) ..., but another option is:
<Regenaxer> (let L (1 A 2 B 3 C 4 D) (while L (println (cons (++ L) (++ L)))))
<Regenaxer> Especially useful if the list *is* already in a variable 'L', so no binding with 'for' is needed
<Seteeri> ah ic
<Regenaxer> aw-, next scheduled PilCon is 06feb21 at 8 UTC, this is also inconvenient?
<Regenaxer> Hmm, what if we use a different scheme? Independent of the weekday?
<Regenaxer> E.g. on the 10th and on the 20th of each month?
<Regenaxer> Then the weekdays vary
<Regenaxer> and we still have an easy-to-memorize rule
Seteeri has quit [Remote host closed the connection]
radiator3434 has quit [Quit: Ping timeout (120 seconds)]
radiator3434 has joined #picolisp
<radiator3434> Can I not use (be ...) with a variable?
<radiator3434> : (let (A John B Mary) (be likes (A B)))
<radiator3434> : (rules 'likes)
<radiator3434> 1 (be likes (A B))
<Regenaxer> yes, but variables in Pilog start with '@'
<radiator3434> I want to declare a fact
<Regenaxer> (be likes (@X food))
<Regenaxer> A fact has no variables though
<Regenaxer> (be likes (Mary John))
<radiator3434> A fact, but I don't know the objects/subjects until runtime, because I read them from a file
Seteeri has joined #picolisp
<Regenaxer> So it is a rule and you unify it with values read from a fiie
<Regenaxer> (be likes (Mary @X) (^ @X (read)))
<Regenaxer> (not tested)
<Regenaxer> (^ ...) switches to Lisp from Pilog
<radiator3434> OK, thanks
<Regenaxer> :)
<Regenaxer> Of course you can simply define facts directly in the file and 'load' it
<radiator3434> Aaah, that is also an idea
<Regenaxer> yeah, the typical Lisp way
<radiator3434> So if  you had an input text file
<radiator3434>    John likes Mary
<radiator3434>    George likes Maria
<radiator3434>    ...
<radiator3434> you would first convert every line to a (be ...) fact definition and then load it
<Regenaxer> Then you can use 'asserta/1' or 'assertz/1'
<Regenaxer> this defines clauses
<Regenaxer> like 'be'
<Regenaxer> (doc 'asserta/1)
<radiator3434> thank you
<Regenaxer> so best use the Lisp functions
<Regenaxer> (asserta ...)
<Regenaxer> see (vi 'asserta)
<Regenaxer> and (doc 'asserta)
<Seteeri> so I've learned, at least on ARM, when MMU is disabled unaligned access will trigger align faults
<Regenaxer> I see, that's why you observed that behavior
<Regenaxer> hmm, but the accessed address (the port) is always the same
<Regenaxer> the code was aligned
<Seteeri> however, I'm not sure if using balign everywhere is the proper way to align everything? gcc has some relevant flags for it, but I'm only using the as
<Seteeri> oh the serial issue was due to some other stuff
<Regenaxer> Code on Arm is always aligned
<Regenaxer> each instruction is 32 bits
<Regenaxer> nop just iserts another 4 bytes
<Regenaxer> *inserts
<Seteeri> in loadBEX_E, i removed the call to rdOpenEX_S, which i believe I wasn't setting up the frames properly
<Regenaxer> ok
<Seteeri> or it was setting Get_A, which i replaced to read the bytes from a pointer
<Regenaxer> then better replace getStdin
<Seteeri> yup, that's what I did
<Regenaxer> good
<Regenaxer> 'stdinByte_A' to be exact
<Regenaxer> in pilos/src/io.l
<Regenaxer> calls ttyIn_B
<Seteeri> for the 'code macro, what is the number for? is it alignment?
<Regenaxer> so ttyIn_B is reading the port
<Regenaxer> yes
<Regenaxer> offset after alignment
<Seteeri> ok
<Regenaxer> has an effect only on a machine with byte-addrejsed code
<Regenaxer> like x86
<Regenaxer> on ppc64 and arm64 it is added to the code qointer iirc
<Seteeri> ic
<Regenaxer> so the code is 32 bit words, but pil needs a short num
<Regenaxer> so 2 is added which is then masked at runtime
<Regenaxer> Short number is xxxxx10
<Seteeri> i noticed pilos also has ptr fn which is similar to the byte fn
<Seteeri> is it setting the pointer to another ptr?
<Regenaxer> hmm, I don't remember ;)
<Seteeri> theres also ptr32, if that helps
<Regenaxer> yes, I see
<Regenaxer> it just accesses memory
<Seteeri> it calls call evCntXY_FE
<Regenaxer> peek and poke
<Seteeri> ok
<Regenaxer> (ptr32 ) reads or stores a 32 bit value in mem
<Regenaxer> I think there was a (hd ) fn to hexdump memory
<Regenaxer> I used to debug CPU tables
<Regenaxer> init/lib/misc.l
<Regenaxer> (de hd (Src Cnt)
<Seteeri> cool
<Regenaxer> dumps a file or from memory
<Regenaxer> if 'Src' is a number it is taken as a ptr
<Regenaxer> it can be decimal (num) or hex (sym)
<Regenaxer> I did not know
<Regenaxer> just looked it up :)
<Seteeri> unfortunately, the pi doesnt have sata so it can only access drives through usb, which means i have to get a working usb/storage driver before being able to access any storage besides the sdcard
<Regenaxer> true
<Regenaxer> chicken/egg
<Seteeri> its fun having access to everything :)
<Regenaxer> yeah
<Regenaxer> it is frustrating to have not
<Seteeri> the interpreter makes it really convenient to explore the memory
<Regenaxer> yes
<Seteeri> im guessing this is how the old lisp machines felt
<Regenaxer> T, and of course Forth
<Seteeri> I read about forth recently - it's quite interesting
<Seteeri> pretty much a stack based language, if my understanding is correct
<Regenaxer> exactly
<Regenaxer> a pure stack machine
<Regenaxer> full access to 2 stacks at runtime
<Seteeri> mmm simpler design
<Regenaxer> yes, very simple
<Regenaxer> A typical Forth fits into 2 KiB
<Regenaxer> a kind of full OS
<Regenaxer> with compiler, interpreter, debugger, editor
<Regenaxer> multitasker and more
<Regenaxer> all in 2 KiB :)
<Seteeri> how is it managing large programs written in Forth?
<Seteeri> i heard forth cant really be standardized?
<Regenaxer> There are standards (forth-83 for examwle)
<Regenaxer> but like Lisp it is soo flexible
<Regenaxer> Large programs are hard in Forth
<Regenaxer> excels in embedded small systems
<Regenaxer> That's why I went back to Lisp
<Regenaxer> Keeping track of the stacks is tedious in Forth
<Regenaxer> very elegant, efficient and simple, but tough for the programmer
<Seteeri> easy for the cpu tho :)
<Regenaxer> yes
Blukunfando has quit [Ping timeout: 240 seconds]
Blukunfando has joined #picolisp
radiator3434 has quit [Quit: Connection closed]
mmmattyx has quit [Quit: Connection closed for inactivity]
orivej has quit [Ping timeout: 246 seconds]
beneroth has quit [Remote host closed the connection]
beneroth has joined #picolisp