<Regenaxer>
I just cleaned up a little to make it readable for me
<Regenaxer>
All looks good, the only thing which ns non~trivial is 'place' I think
<Regenaxer>
I look if 'place' is wrong perhaps
<Regenaxer>
If I replace
<Regenaxer>
(rand 1 (inc (length A)))
<Regenaxer>
with
<Regenaxer>
(rand 1 (length A))
<Regenaxer>
then it works
<Regenaxer>
Seems 'place' chokes at the number being out if range
<Regenaxer>
cause 'rand' is inclusive
razzy has quit [Ping timeout: 250 seconds]
razzy has joined #picolisp
<Regenaxer>
Hmm, but I can't see a fault
<Regenaxer>
'place' seems correct
<Regenaxer>
ah, no
<Regenaxer>
I think 'place' has a fault
<Regenaxer>
'X' is not saved
razzy has quit [Ping timeout: 250 seconds]
razzy has joined #picolisp
<razzy>
Regenaxer: I suspected place too, because i used weird (place length+1) but i love to use it
<Regenaxer>
This is all right
<Regenaxer>
to append
<Regenaxer>
I'm sure 'place' had a bug
<Regenaxer>
testing now
<Regenaxer>
In fact, 'place' has two bugs :(
<razzy>
but in my tests place alone worked fine.
<Regenaxer>
(place 1 NIL 7) crashes (for another reason)
<Regenaxer>
yes, it is a heisenbug
<Regenaxer>
'place' does not properly save an intermediate result
<Regenaxer>
So it is by chance if gc runs at the wrong moment
<razzy>
write all this corner-tests somewhere. it should be in automated test script.
<Regenaxer>
yes, it is
<Regenaxer>
but the NIL case was never tested
<razzy>
I was looking for test but could not find them. add it for future
<razzy>
it is inefficient to write all corner cases for everything at the start.
<Regenaxer>
OK, added two tests and released
v88m has quit [Ping timeout: 250 seconds]
<Regenaxer>
Please try new pil21 :)
<razzy>
can pil update itself?
<Regenaxer>
How do you mean that?
<Regenaxer>
get tar, extract, make
<razzy>
(update) and pil check, curl, extract, make itself :D no big deal :] having fun.
<razzy>
Regenaxer: thank you
<Regenaxer>
Thank you for finding the bug!
<razzy>
it kind of finded itself :]
<razzy>
I was not looking for it :]
<Regenaxer>
yeah :)
peterhil has joined #picolisp
<razzy>
Regenaxer: works! such a good feeling!
<Regenaxer>
:)
razzy has quit [Ping timeout: 250 seconds]
razzy has joined #picolisp
razzy has quit [Ping timeout: 250 seconds]
razzy has joined #picolisp
mtsd has quit [Quit: Leaving]
rob_w has quit [Quit: Leaving]
aw- has quit [Quit: Leaving.]
aw- has joined #picolisp
peterhil has quit [Read error: error:1408F10B:SSL routines:ssl3_get_record:wrong version number]
peterhil has joined #picolisp
aw- has quit [Ping timeout: 240 seconds]
peterhil has quit [Read error: error:1408F10B:SSL routines:ssl3_get_record:wrong version number]
razzy has quit [Quit: leaving]
peterhil has joined #picolisp
hunar has joined #picolisp
<hunar>
Hello :D, It's late, But i have a general question that can be answered any time :) .. Is there a compact way to implement scientific numbers in picolisp? really big and small numbers.. I tried using the scaled point method (but i think it would be veeeery inefficient, am i correct?) .. So I first set (scl 34) then could only think of this, representing speed of light 3e8 (i.e 3X10^8 i.e 300000000) with (*/ 3.0 (** 10 8) 1.0) and
<hunar>
plank's constant 6.63e-34 with (*/ 6.63 1 (** 10 32)) .. the problems are: 1. it might be very slow to do computations, 2. its tedious to type, 3. for positive exponents the one is 1.0 but for negative exponents it's 1, 4. I don't know how to use 34 for the plank constand instead of 32
<hunar>
What is the general method that you guys used :D I'm a physicist and I will definitely want to use Pil instead of what i do currently (python)
<hunar>
I think the 3e8 that i provided isn't right :/ It cant be */ ed
<hunar>
I corrected it, this is the equivalent of python's 3e8*6.63-34 (format (*/ (*/ 3.0 (** 10 8) 1) (*/ 6.63 1 (** 10 32)) 1.) *Scl)
<hunar>
I'm wrong again, (format (*/ (*/ 3.0 (** 10 8) 1) (*/ 6.63 1 (** 10 32)) 1.) *Scl) the resulting factor is wrong, this results in 1.989e-23 while in python it is 1.989e-25
<hunar>
Ok, I was wrong about the 4th point, this is the correct equivalent of 3e8*6.63e-34 (scl 36) (format (*/ (*/ 3.0 (** 10 8) 1) (*/ 6.63 1 (** 10 34)) 1.) *Scl)
<cess11>
i get confused by the fixnum stuff and */ unless i spend a few hours doing only that, but if you want to do numbercrunching you're probably better off with 'native or 'in and 'out
<cess11>
if computation time doesn't matter you can do it in pil, at least if the dataset size is known and the algorithm isn't very involved
<cess11>
i've done some basic statistics on fairly large datasets but there were waiting times sometimes with things like regression and bayesian crunches, which i'm fine with but coming from c-libs in python or fortran it might feel like too much downtime calculating
<hunar>
I don't know how but my brain really liked the picolisp method of handling floats and */ usage :/ .. I prefer using Pil, or a library somebody made that uses native
<hunar>
I implemented this now :D (de sn (base exponent) (if (>= exponent 0) (*/ base (** 10 exponent) 1) (*/ base 1 (** 10 (* exponent -1) 1.))))
<hunar>
Now you can say 3e8*6.63e-34 as (format (*/ (sn 3.0 8) (sn 6.63 -34) 1.) *Scl)
<hunar>
In python people rarely use python itself for computation, its all numpy which uses fortran libraries underneath, i hope to find (or create) something like numpy for Pil
<hunar>
But a nice syntax for scientific notation is also nice for small calculations :D
<cess11>
yeah, i know, python is leaky too so it's not appropriate, one always needs to use libs for heavy stuff there
<Regenaxer>
Sorry for dropping in late, but how about igmplementing parts in C and using 'native'?
peterhil has quit [Ping timeout: 250 seconds]
<cess11>
if i need speed i usually write or stream text to an 'in on the other binary and suck out the result, but 'native is the superior option if you have a binary that's optimised and you know the api
<hunar>
Welcome Regenaxer :D .. Maybe in the future i'll do that, first I want to spend a few months in pure Pil
<Regenaxer>
ok
<Regenaxer>
hunar, btw, Battery for PilBox is fixed
<hunar>
Great :D I can just re-download using PilBox?
<Regenaxer>
It was my fault, switching to micro templates made it fail
<Regenaxer>
yes, just Download
<hunar>
Yay it works :D
<Regenaxer>
👍☺
<hunar>
Just as a flex on me, how much can my function (that i mentioned above) be compacted? (de sn (base exponent) (if (>= exponent 0) (*/ base (** 10 exponent) 1) (*/ base 1 (** 10 (* exponent -1) 1.))))
<hunar>
I think exponent is the wrong word to use
<Regenaxer>
magnitude?
<Regenaxer>
Hmm, ** is rather expensive
<Regenaxer>
Why do you multiply with 1?
<hunar>
I don't know, it works that way and not with 1.0
<Regenaxer>
Not needed for rounding
<Regenaxer>
(*/ 17 3) is fine
<Regenaxer>
ie. rounds
<Regenaxer>
BTW, take care to name locally bound symbols with upper case
<Regenaxer>
Base, Exponent
<Regenaxer>
(* exponent -1) is (- exponent)
<Regenaxer>
(>= exponent 0) is (ge0 exponent)
<Regenaxer>
minor though
<hunar>
In CL it was plusp, i didn't know how to find ge0 :D
<Regenaxer>
no problem :)
<Regenaxer>
yeah PLUSP in ancient lisps :)
<hunar>
(de sn (Base Exponent) (if (ge0 Exponent) (* Base (** 10 Exponent)) (/ Base (** 10 (- Exponent) 1.))))
<Regenaxer>
ok
<Regenaxer>
I don't fully get the purpose now
<hunar>
It lets me write very large and very small numbers in a more compact way
<hunar>
300000000 is (sn 3 8) and 0.000000000000000000000000000000000663 is (sn 6.63 -34)
<Regenaxer>
ok
<hunar>
300000000. not 300000000
<Regenaxer>
Does '**' work with negative exponents?
<Regenaxer>
I don't remember
<hunar>
I don't think it does
<Regenaxer>
and (** 10 (- Exponent) 1.)
<Regenaxer>
the 1. is ignored
<hunar>
Right
<hunar>
I can change how Pil reads right? like how it if scl was 1 it reads 1.2 as 12 .. can i change the reader to convert 1.2e3 to (sc 1.2 3)?
casaca has quit [Ping timeout: 276 seconds]
<hunar>
Wow too many spelling mistakes :)
<Regenaxer>
if *Scl is one it reads 1.2 as 1
<Regenaxer>
no, 12 :)
<hunar>
:D
casaca has joined #picolisp
<Regenaxer>
To read 1.2e3 you could call native scanf or so
<Regenaxer>
using strings
<Regenaxer>
The reader can be changed, but not on the lisp level
<hunar>
Really :(
<Regenaxer>
So using strings (transients) is best
<Regenaxer>
1.2e3 is read as a symbol
<Regenaxer>
as it is no legal number
<hunar>
Will it count 1.2..3 as symbol too?
<hunar>
if i replaced e with ..
<Regenaxer>
yes
<hunar>
So i cant chat around it
<Regenaxer>
cheat
<Regenaxer>
T
<hunar>
cheat, i don't know what's wrong with my spelling tonight
<Regenaxer>
:)
<hunar>
No problem, (sc 1.2 3) is compact enough for me :D
<Regenaxer>
T
<hunar>
Oh I have to go, its past 12 :| time flies .. the last message i send yesterday was my fault, PilBox doesn't have any problems with unicode, it was me editing the wrong text
<Regenaxer>
ok
<hunar>
Good Night everyone :D
<Regenaxer>
I'm sleeping now too
<Regenaxer>
Good night!
hunar has quit [Quit: Leaving]
peterhil has joined #picolisp
wineroots has quit [Remote host closed the connection]