_whitelogger has joined #picolisp
bjorkintosh has quit [Ping timeout: 276 seconds]
bjorkintosh has joined #picolisp
AragornGuardian has joined #picolisp
AragornGuardian has quit [Changing host]
AragornGuardian has joined #picolisp
<
tankf33der>
Morning all
<
tankf33der>
abu[7]
<
abu[7]>
Morning tankf33der!
<
tankf33der>
How would you generate such a file in picolisp?
<
abu[7]>
What format is .zig ?
<
tankf33der>
Just txt file
<
abu[7]>
just text?
<
abu[7]>
Basically 'print' and 'prin', no?
<
tankf33der>
Is this combinatorica task?
<
abu[7]>
similar to Json
<
abu[7]>
combinatorical ?
<
tankf33der>
Bits permutations
<
abu[7]>
You mean the "[_]u128{0x00000000000000000000000000000000, ..." stuff?
<
abu[7]>
It is hex with padding?
<
tankf33der>
I even do not know how to do it without hex
<
abu[7]>
the padding?
<
tankf33der>
Bit permutations
<
abu[7]>
I do not see how it is permuted
<
abu[7]>
0x0....FFFF
<
abu[7]>
You mean reverse all bits in a number or string?
<
abu[7]>
(flip (chop ..)) ?
<
tankf33der>
I do not understand how to manilulate bits.
<
abu[7]>
So these u128 have the most significant bit on the right?
<
abu[7]>
(let (N (hex "123") R 0) (until (=0 N) (setq R (| (>> -1 R) (& 1 N)) N (>> 1 N))) (hex R))
<
abu[7]>
(let (N (bin "101001110111") R 0) (until (=0 N) (setq R (| (>> -1 R) (& 1 N)) N (>> 1 N))) (bin R))
<
abu[7]>
-> "111011100101"
<
abu[7]>
A bit expensive for big numbers though ;)
<
abu[7]>
Perhaps better:
<
abu[7]>
: (setq N (bin "101001110111"))
<
abu[7]>
: (bin (flip (chop (bin N))))
<
abu[7]>
-> "111011100101"
<
abu[7]>
*might* be faster
<
tankf33der>
Uuuuu. Ok
Guest7981 has quit [Ping timeout: 244 seconds]
user3456 has joined #picolisp
user3456 is now known as Guest6028
switchy has quit [Ping timeout: 252 seconds]
switchy has joined #picolisp
<
tankf33der>
abu[7]: how to use new simul~permute with callback "Fun"?
<
abu[7]>
: (simul~permute (1 2 3) println)
<
abu[7]>
-> (1 2 3)
<
abu[7]>
: (make (simul~permute (1 2 3) link))
<
abu[7]>
-> ((1 2 3) (1 2 3) (1 2 3) (1 2 3) (1 2 3) (1 2 3))
<
abu[7]>
: (make (simul~permute (1 2 3) '((L) (and (=1 (car L)) (link (cdr L))))))
<
abu[7]>
-> ((2 3) (2 3))
<
tankf33der>
(make (simul~permute (1 2 3) link))
<
tankf33der>
((1 2 3) (1 2 3) (1 2 3) (1 2 3) (1 2 3) (1 2 3))
<
tankf33der>
but no permutations
<
abu[7]>
oops, yes, it is destructive
<
abu[7]>
needs 'copy"
<
abu[7]>
: (make (simul~permute (1 2 3) '((L) (and (=1 (car L)) (link (copy (cdr L)))))))
<
abu[7]>
-> ((2 3) (3 2))
<
abu[7]>
This is for efficiency
<
tankf33der>
have to do it this way, because i need permute with repeatitions
<
abu[7]>
(for L N (println L)) could be simply (mapc println N)
<
abu[7]>
just for the records ;)
<
tankf33der>
yea, sure. :)
Iacob has quit [Quit: IRCNow and Forever!]
gahr has quit [Remote host closed the connection]
gahr has joined #picolisp
AragornGuardian has quit [Ping timeout: 272 seconds]