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 quit [Ping timeout: 258 seconds]
alexshendi has joined #picolisp
orivej has joined #picolisp
orivej has quit [Ping timeout: 245 seconds]
jibanes has quit [Ping timeout: 244 seconds]
jibanes has joined #picolisp
grp has quit [Quit: box shutting down...]
xkapastel has joined #picolisp
_whitelogger_ has joined #picolisp
_whitelogger has quit [Ping timeout: 250 seconds]
_whitelogger has joined #picolisp
alexshendi has quit [Read error: Connection reset by peer]
orivej has joined #picolisp
orivej has quit [Ping timeout: 258 seconds]
xkapastel has quit [Quit: Connection closed for inactivity]
orivej has joined #picolisp
orivej has quit [Ping timeout: 268 seconds]
rob_w has joined #picolisp
_whitelogger has joined #picolisp
m_mans has joined #picolisp
m_mans has quit [Quit: Leaving.]
razzy has quit [Ping timeout: 246 seconds]
m_mans has joined #picolisp
m_mans has quit [Quit: Leaving.]
orivej has joined #picolisp
m_mans has joined #picolisp
orivej has quit [Ping timeout: 250 seconds]
m_mans has quit [Quit: Leaving.]
orivej has joined #picolisp
xkapastel has joined #picolisp
orivej has quit [Ping timeout: 250 seconds]
m_mans has joined #picolisp
m_mans has quit [Quit: Leaving.]
pchrist has quit [Quit: leaving]
pchrist has joined #picolisp
orivej has joined #picolisp
alexshendi has joined #picolisp
<alexshendi> Good evening. I have just written my first useful picolisp program (94 lines). Could anyone be so kind to review it? I would like some pro tips.
orivej has quit [Read error: Connection reset by peer]
orivej has joined #picolisp
<Regenaxer> Good evening alexshendi!
<Regenaxer> Sure, let us see :)
<Regenaxer> (I've some red wine intus though ;)
<alexshendi> Good evening Regenaxer. Where can I paste it?
<Regenaxer> ix.io ?
<Regenaxer> I use: (out '("curl" "-sF" "f:1=<-" "ix.io") (prinl ...
<Regenaxer> This is a fragment from @lib/vip.l
<Regenaxer> Or pastebin?
<alexshendi> http://ix.io/1xwX
<alexshendi> Had to restart my laptop...
<Regenaxer> np :)
<Regenaxer> Is this inspired by the rosettacode bitmap tasks?
<alexshendi> I want to write a raycaster and need to scale textures. This is a first step.
<Regenaxer> cool!
<alexshendi> Didn't know about the bitmap tasks.
<Regenaxer> What is 'any' in 'go1' needed for?
<Regenaxer> 'any' is not used normally
<alexshendi> To convert from a symbol to number.
<Regenaxer> Then better use 'format' directly
<alexshendi> OK.
<Regenaxer> Formally the code looks good
<Regenaxer> I don't understand what it does exactly on the first glan
<Regenaxer> ce
<Regenaxer> and so late ;)
<Regenaxer> interpolateBilinear : (/ ... 65025)
<Regenaxer> you might consider using (*/ ... 65025)
<Regenaxer> */ rounds the result
<alexshendi> I was wondering if a list of lists is the right datastructure for a bitmap.
<Regenaxer> well, yes, it is not the most efficient if the bitmap is big
<alexshendi> Maybe a tree (as built by idx) is faster.
<Regenaxer> yes, if access needs to be random
<Regenaxer> another option is 'grid' in @lib/simul.l
<Regenaxer> it allows fast access to neighbors
<alexshendi> Maybe I should add some comments :)
<Regenaxer> or even 'malloc' a plain memory and operate on it with 'native', but that's extreme ;)
<Regenaxer> As I said, the code looks good
<Regenaxer> Some style issues, but that's more a matter of taste
<alexshendi> It is quite fast as it is, even though I only tested it for scaling 64x64 to 64x512
<Regenaxer> ok
<Regenaxer> (+ Y 1) is just (inc Y)
<Regenaxer> What does 'bitmapGetPixel' do?
<Regenaxer> get a range?
<alexshendi> I am used to hyphen separated function names...
<Regenaxer> :)
<Regenaxer> Possible in pil too, I have no problem with such names
<alexshendi> it gets the R G B and alpha components as a list.
<Regenaxer> But as pil is case sensitive, they are not so needed
<Regenaxer> (list 1 2 3 4) is unnecessary overhead
<Regenaxer> can be constant (1 2 3 4)
orivej has quit [Ping timeout: 246 seconds]
<Regenaxer> or use (4 8 12 16) to avoid the multiplication
orivej_ has joined #picolisp
<Regenaxer> oops, no
<alexshendi> OK, numeric lists don't need to be quoted...
<Regenaxer> X1 is multiplied :)
<Regenaxer> yes
<Regenaxer> all no real problems
<Regenaxer> Is (copy Pixel) necessary?
<Regenaxer> I have a bit trouble to read the code due to unusual indentation for me
<alexshendi> I figured it would be necessary, so that different fields have different instances of the same list.
<Regenaxer> copy is only needed if you want to avoid destructive modifications
<alexshendi> What happens when I want to (destructively) modify the bitmap later?
<Regenaxer> Then cells in the map are modified
<Regenaxer> For example, I would rewrite:
<Regenaxer> (de bitmapSetPixel (Bitmap X Y Pixel)
<Regenaxer> (mapc
<Regenaxer> (set
<Regenaxer> '((X1 X2)
<Regenaxer> (nth Bitmap (inc Y) (+ (* 4 X) X1))
<Regenaxer> X2 ) )
<Regenaxer> (1 2 3 4)
<Regenaxer> Pixel )
<Regenaxer> Bitmap )
<Regenaxer> (inc Y) and (* 4 X) could be outside the loop
<Regenaxer> but probably no difference in speed
<Regenaxer> Sorry, I'm too sleepy now :)
<alexshendi> Just a question (inc X) does not change X?
<Regenaxer> Let's continue tomorrow or so?
<Regenaxer> yes
<Regenaxer> (inc 'X) changes it
<Regenaxer> (inc X) is identical to (+ X 1)
<alexshendi> Of course. Thank you for your time.
<Regenaxer> Fun for me :)
<Regenaxer> Good night! :)
<alexshendi> Good night.
<Regenaxer> :)
alexshendi has quit [Ping timeout: 246 seconds]
orivej_ has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp