Re: Unsubscribe

2023-05-31 Thread Danilo Kordic
Is there still room in the queue ;) ?

On Wed, May 31, 2023, 23:02 Andrew Chou  wrote:

>


Re: abort in less than a second

2023-04-23 Thread Danilo Kordic
  I would use Linux.epoll.  pil doesn't have it... yrt.

On Mon, Apr 24, 2023, 06:10 polifemo  wrote:

> I have a loop that executes a prg and then waits for the user to input
> something. If the user does not input anything within the timeout, the
> waiting is aborted and the loop restarts.
> The problem is that, I want the timeout to be much faster, but 'abort only
> works in seconds. Is there a way to abort a program after M milliseconds?
>


Re: quote form in picolisp

2021-12-15 Thread Danilo Kordic
Hi pd

  It seems You are looking for Wikipedia/Currying .  What are Your further
thoughts?

  What do  You think about Wikipedia/De_Bruijn_index ?

On Thu, Dec 16, 2021, 06:27 Danilo Kordic  wrote:

>   Trolls!?
>
> On Thu, Dec 16, 2021, 02:59 Erik Gustafson 
> wrote:
>
>> Sorry all,
>>
>> I regret my 'Feature Request' mail, pushing additional complexity
>> to the language to make a few lines of code more aesthetically pleasing
>> (to me), and awakening the trolls.
>>
>


Re: quote form in picolisp

2021-12-15 Thread Danilo Kordic
  Trolls!?

On Thu, Dec 16, 2021, 02:59 Erik Gustafson 
wrote:

> Sorry all,
>
> I regret my 'Feature Request' mail, pushing additional complexity
> to the language to make a few lines of code more aesthetically pleasing
> (to me), and awakening the trolls.
>


Re: New blog - "PicoLisp for beginners"

2021-09-08 Thread Danilo Kordic
  Fun Arg Problem?!


On Wed, Sep 8, 2021, 16:11 O.Hamann  wrote:

> Welcome Mia!
>
> I followed the steps of your install pil21 on win10/WSL blog post - and
> it worked fine, thanks for putting all (WSL+Linux+pil21) together in one
> recipe.
>
> (I only had to do a 'sudo apt update'  before Ubuntu did install the llvm)
>
>
>
> Reading over your nice list of planned topics, 'Segmentation Fault' and
> 'Dynamic Binding' come to my mind.
>
> An application / commandline tool quitting with segfault is so very
> uncommon nowadays, that new friends of picolisp might think more of a
> 'faulty program' than conscious design decisions of the picolisp author.
>
> Writing the first experimental code lines in a file on disk and
> loading it with 'pil mycode.l +' helped me a lot to lower my frustration
> about having typed in 10 lines of code in the REPL which were all wiped
> out by my false function calls in the beginning.
>
>
>
>
> 'Dynamic Binding' is rarely used today, I guess, and might lead to
> trouble for experienced programmers, who come from other languages,
> which follow the 'lexical binding' paradigm(?).
>
> There was a PilCon talk on this and I tried to find a simple rule,
> how to avoid problems or how to recognize in advance if problems would
> occur, but I do not have that present.  Perhaps we could raise this
> topic in the mailing list again one day.
>
> So this could be an entry with question mark (I'm not really sure how
> relevant this topic is) in your nice content list.
>
>
> Keep on writing :-)
>
> Kind Regards,
> Olaf
>
>
>
>
>
>
> On 01.09.21 11:57, Mia Burger wrote:
> > Hi all,
> >
> > I'm Mia, one of Alex' daughters, nice to meet you!
> >
> > I started to play around with PicoLisp a few months ago. So I checked
> > the available resources, and after a while I thought it might be good to
> > have a little bit more "beginner's level" content, with a low threshold
> > and fun to read. Because I feel that a lot of it is already quite
> > advanced (or of rather mixed difficulty), which can be quite frustrating


Re: Subscribe

2021-05-03 Thread Danilo Kordic
  I am blessed with https://devnull-as-a-service.com/ .  mv -f $on !!

On Mon, May 3, 2021, 00:18 A. Laszlo Ross  wrote:

> Hello "A. Laszlo Ross"  :-)
> You are now subscribed
> 
>
>
>
>
>
> ~~~
> Note: I am in the process of automating some aspects of my personal and
> professional life.
>
> This message may or may not be automated. Here’s a random emoji:
> 
> ~~~
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>


Re: Subscribe

2021-04-28 Thread Danilo Kordic
  Welcome.

  I will be glad to chat on IRC.

On Tue, Apr 27, 2021, 14:07 Pierre Baille  wrote:

> Hello Pierre Baille  :-)
> You are now subscribed
> 
>
> Hello,
>
> I'm interested in PicoLisp
>
> Pierre
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>
>


Re: IRC channel at Freenode

2021-04-10 Thread Danilo Kordic
  I recomend compiling Suckless.org/ii with tcc for a start.  Until You
make your own IRC client.


Re: Picolisp Outlook

2021-02-23 Thread Danilo Kordic
On Tue, Feb 23, 2021, 23:06 Davide BERTOLOTTO 
wrote:

> After all these years I am still wondering how people like complicated
> sintaxes full of special forms more than the simplicity of lisp. After all,
> the parentheses and the prefix notation do not look so terrible to me,
> especially considering that you gain a lot in clarity and simplicity of the
> language. Probably is the same reason that pushes people to create yet
> another programming language every now and then xD.
>

  Exactly!

  C(11) is not a write-only language, but at best a write-once language!!
A Turing Tarpit.

  `` Fools ignore complexity.  Pragmatists suffer it.  Some can avoid it.
Geniuses remove it.
   '' -- Alan Perlis, Epigrams on Programming

On Tue, Feb 23, 2021, 21:03 pd  wrote:
>
>>
>>
>> On Tue, Feb 23, 2021 at 5:00 PM Danilo Kordic 
>> wrote:
>>
>>>   'float' could be implemented as a lib.
>>>
>>
>> yes, but the point here it is not at core and even having a float lib or
>> whatever science lib, python is plenty of them and a nicer syntax
>>
>> it's not about me neither talking about (pico)lisp features and better
>> syntax, I'm yet convinced 'cause I'm a schemer thus a lisper and I'm here
>> in that list after all
>> But most people don't think so and no matter how better and nicer I find
>> the lisp syntax, the world thinks the opposite ;-)
>>
>> maybe you can find a killer app or even a killer science app leting
>> picolisp shine but as soon as people has to program in picolisp (I mean
>> scripting) they will feel uncofortable, they will always prefer R or
>> python, just for syntax, not talking about huge amount of libraries and
>> community support,  developers should enjoy (pico)lisp facilities to
>> develop and organice knowledge but as soon as had practical issue the lack
>> of specialized libraries will make them comply thinking in wide spread
>> python or ruby (just talking dynamic 'script' languages only)...
>>
>> It's not a problem of picolisp only, it's common to all lisp dialects and
>> even cool minor languages... This is the reason for using lua for scripting
>> rather than picolisp, guile or even tcl
>> Also this is the problem for all lisp about their use in real apps,  I
>> see this in common lisp, in scheme, ...  The only lisp-like with hype and
>> relative wide use is clojure and one key reason is libraries (achieved by
>> jvm side)
>>
>> And this is how it's gonna be... we live in the dictatorship of C-like
>> syntax world! ;-)
>>
>> (damnification is not only in lisp world,  same happen to smalltalk and
>> derivatives, forth-like derivatives and so on)
>>
>
  This is complete rubbish (IMHO)!!  You are not even a normie, but an
NPC!!


Re: Picolisp Outlook

2021-02-22 Thread Danilo Kordic
  Yes.  CLOSOS assumes Common Lisp.

  ATM I am studying Intel N4100 on which to experiment with them.

On Mon, Feb 22, 2021, 09:32 Alexander Burger  wrote:

> On Sun, Feb 21, 2021 at 08:08:26PM +0100, Danilo Kordic wrote:
> >   LispM ( http://metamodular.com/closos.pdf ).
>
> Nice article! Looks a lot like PilOS, no?
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>
>


Re: Picolisp Outlook

2021-02-21 Thread Danilo Kordic
  LispM ( http://metamodular.com/closos.pdf ).

On Sun, Feb 21, 2021, 17:58  wrote:

> It's 2021, Software is eating the world, people are flocking to Python and
> Javascript mainly, we're swimming in machine learning and AI and serverless
> and what not. In the current times, where do you see the future of Picolisp
> in the years to come? What do you see as the killer feature that could help
> Picolisp to strive and survive? What do you think is missing in the
> Picolisp ecosystem?
> Any ideas and insights would be highly appreciated.
> Regards,
> Tom
>


Re: Pil21 is now in Debian Unstable

2021-01-02 Thread Danilo Kordic
  Now we are the knights who say LLVM.

On Thu, Dec 31, 2020, 04:51  wrote:

> Congratulations!  \o/
>
> On Tue, 29 Dec 2020 08:23 -05:00, Alexander Burger wrote:
> > Hi all,
> >
> > On Tue, Dec 29, 2020 at 11:29:22AM +, Mike wrote:
> > > Happy coding and New Year,
> >
> > Thanks a lot to Mike Pechkin for all the testing, feedback, input and
> support,
> > and to Kan-Ru Chen for maintaining the Debian releases! And to all other
> members
> > in this list and the #picolisp IRC channel!
> >
> > ☺/ A!ex
> >
> > --
> > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
> >
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>


Re: Pil21 feature questions

2020-12-22 Thread Danilo Kordic
> (map * Lst (circ Factor))

*`[let [Circ [1 .]]*
*   '[let [`Circ Factor]*
* (mapcar * Lst `Circ)) ] ]*

On Tue, Nov 10, 2020, 13:57 Andras Pahi  wrote:

> Hi Alex,
>
> Thank you for the descriptions.
>
> Regards,
> Andras
>
> > On 2020. Nov 10., at 12:49, Alexander Burger 
> wrote:
> >
> > Hi Andras,
> >
> >> I would like to ask some questions on Pil21 features.
> >> It is enough if you points to some examples where I could dig into the
> >> details...
> >
> > These are indeed very good questions! Thanks that you ask, they need to
> be
> > clarified.
> >
> >
> >> - What is special in the ‘priv’ namespace handling?
> >>  pil64 used it to store (private) symbols.
> >
> > I noticed that the way pil64 implemented the 'private' function was not
> good.
> >
> > It created a normal namespace 'priv' on-the-fly, interned the given
> symbols into
> > that namespace, and then put 'priv' as the *second* namespace in the
> search
> > order:
> >
> >   : (private) foo  # Intern 'foo' in 'priv'
> >
> >   : (symbols)  # Search order
> >   -> (pico priv)
> >
> > So now 'foo' is indeed private. The problem is that *if' another symbol
> named
> > "foo" exists in 'pico', it overshadoes the 'foo' in 'priv', and this is
> not what
> > is expected for a private symbol.
> >
> >
> > Pil21 implements a special handling for 'priv'. Now 'priv' is part of the
> > interpreter core, and behaves a little different from normal namespaces


Re: Stop using US controlled software stacks!!!

2020-04-27 Thread Danilo Kordic
Gudo Stepken:
> [...]

  ""Talk is cheap, show me the code."" -- Linus Torvald

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: accessing list items and other structures

2020-01-28 Thread Danilo Kordic
[load "@misc/setf.l"]


On 1/29/20, pd  wrote:
> Hello,
>
> I'd like to know if there's in picolisp the common lisp concept of places,
> I mean, is it possible to do this:
>
> (setq L (1 2 3))
> (set (car L) 'x)
> L -> (1 x 3)
> (set (cdr L) '(a b))
> L -> (1 a b)
>
> I'd say it is not places in picolisp, but reference manual says:
>
> : (set 'L '(a b c)  (cdr L) '999)
> -> 999
> : L
> -> (a 999 c)
>
>
> Which seems similar to places or at least to the use of setf in common
> lisp, but what I find strange is in my understanding the set form above
> should lead to L -> (a 999)  or even (a . 999) because (cdr L) is (b c) and
> thus replacing cdr L with 999 leads to (a 999)... where's my error?
> For me L should be (a 999 c) only if the set form were:
>
> : (set 'L '(a b c) (cadr L) '999)
>
> Also, if not having places, have we got scheme's setcar and setcdr at
> least?
>
> Is there any way of manipulating parts of lists and even objects rather
> than using specific functions such as delete, replace and so on ?
>
> regards
>

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: why is there no setf in picolisp?

2019-06-27 Thread Danilo Kordic
  [setf (+ (** c 2) (+ (* -5 c) 6)) 0] ?!


On Thu, Jun 27, 2019, 07:39 Alexander Burger  wrote:

> Hi Bruno,
>
> > So, why is there no setf in picolisp?
>
> The answer is simple: It does not make sense.
>
> PicoLisp is a pure interpreter, and what 'setf' does is setting the value
> of
> what the expression *would* return. I'm not fit in CommonLisp, but
>
>(setf (car X) 7)
>
> means to set the CAR of the cell pointed at by X to 7.
>
> So a compiler analyzes the argument (car X), and compiles
>
>(set X 7)  # in PicoLisp
>
> Similarly,
>
>(setf (get 'X 'a) 7)
>
> compiles to
>
>(put 'X 'a 7)
>
>
> There is a 'setf' function in PicoLisp (meant as a joke) in
>
>misc/setf.l
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Code review request: breaking a list into batches

2019-04-27 Thread Danilo Kordic
  I would simply use a Dequeue, like 'fifo'.

On Sun, Apr 21, 2019, 19:44 C K Kashyap  wrote:

> Thanks Alex! - that's the kindest "cut" :)
> Regards,
> Kashyap
>
> On Sun, Apr 21, 2019 at 10:24 AM Alexander Burger 
> wrote:
>
>> Hi Kashyap,
>>
>> > (de batch (l s) # l: input list, s = batch size
>> >  (let ts (* -1 s)
>> > (make
>> > (while (< 0 (length l))
>> > (link (head s l))
>> > (setq l (tail ts l))
>> >
>> > I'd love to get some feedback on this.
>>
>> First I would suggest to stick with the convention of upper case local
>> variables, to avoid severe foot damage ;)
>>
>>(de batch (L S)  # L: input list, S = batch size
>>   (let Ts (* -1 S)
>>  (make
>> (while (< 0 (length L))
>>(link (head S L))
>>(setq L (tail Ts L)) ) ) ) )
>>
>> Then a few improvements:
>>
>>— Instead of (* -1 S) better use the unary minus (- S) It avoids a
>>  multiplication and just sets a sign bit
>>— (while (< 0 (length L)) ..) is expensive, as it counts the length of
>> the
>>  list each time. Better use a simple (while L ..)
>>— 'head' and 'tail' can be replaced by 'cut'
>>
>>
>> With that, we get:
>>
>>(de batch (L S)  # L: input list, S = batch size
>>   (make
>>  (while L
>> (link (cut S 'L)) ) ) )
>>
>> ☺/ A!ex
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>


Re: pgint.l

2019-01-17 Thread Danilo Kordic
  IMHO (PicoLisp) Namespaces _are_ "name" prefixes, for example "pg~"
instead of "pg-".

[de pg []]  # Empty Namespace.
[de pg~sym ~...]

  Unfortunately Namespaces are not Association Lists, or Property Lists.
Therefore they can not be processed by predefined procedures.  I must point
out that Namespace interface is not exposed (as PicoLisp procedures), like
"get" and so on for Property Lists!!


Re: Chinese input causes mess in the REPL

2018-01-28 Thread Danilo Kordic
  GNU Emacs can be used as a line editor.  Execute elisp expression
``(term "/absolute/path/to/pil")'' then activate `term-line-mode' with
``C-C C-j''.

  Is this of any help?  How much does it count :) ?

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Floating Point numbers vs Fixpoint numbers

2017-08-12 Thread Danilo Kordic
  I think it can be either way.  It was just slightly more convenient for me to
make it negative so I can use existing `read'er like ``(Scl 1.0 *Scl)''.

  As the comment in `Scl' should explain the intended meaning of `Scl' is
``(= (Scl S E) (* S (** 10 E)))''.  If ``1.0'' becomes ``100'' then `E' should
be -2.

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Floating Point numbers vs Fixpoint numbers

2017-08-11 Thread Danilo Kordic
: [load 'Scl.l]
: [symbols 'Scl.l 'pico]
: [scl -20]
: (* (* (Scl 9.9 *Scl) (Scl 9.789 *Scl)) (Scl 9.56789 *Scl))
-> (Scl 927234744579000 -60)
: (normalize @)
-> (Scl 927234744579 -9)
: [setq N @  A (Scl 927.23474457900010747835 *Scl)]
: (- A N)  # Absolute Error
-> (Scl -10747835 -20)

Does it make any sense?


Scl.l
Description: Binary data


Re: Floating Point numbers vs Fixpoint numbers

2017-08-11 Thread Danilo Kordic
: [load 'Scl.l]
: [symbols 'Scl.l 'pico]
: [scl -20]
: (* (* (Scl 9.9 *Scl) (Scl 9.789 *Scl)) (Scl 9.56789 *Scl))
-> (Scl 927234744579000 -60)
: (normalize @)
-> (Scl 927234744579 -9)
: [setq N @  A (Scl 927.23474457900010747835 *Scl)]
: (- A N)  # Absolute Error
-> (Scl -10747835 -20)

Does it make any sense?

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: pico? (num)

2017-06-13 Thread Danilo Kordic
Hi Alex,

> >   If `lambda' (Lisp-defined Procedures) is `lst' why `num' is not?!
>
> I'm not completely sure how you mean that, but you can also "define" a number:

  [path "@src64/structures"] defines `num' as a list of ``cell's.  How
to do `cons', `car' and `cdr' on it.  Even shifting (`>\
>') by 64 (32) bits will copy the whole `num'.  Why `cnt?' is not defined?

  ATM we have:
[de fun . quote]

  Maybe `fun' and `list' should be `sym'bolic tags, and their
`apply'cation an Irreducible Form (`=='), if arguments are valid\


pico? (num)

2017-06-13 Thread Danilo Kordic
  If `lambda' (Lisp-defined Procedures) is `lst' why `num' is not?!

  Even if both `num' and `cnt' are defined in `structures', why `num'
can not be operated on as a `lst' that it is?!

  I think it would be (uber cute) to implement `num' as `lst' of `cnt'
as pure PL lib :) .  Even in 32-bit version.

  I think `(doc 'eval)' should be the main part of the Reference :) .
As we all know, to implement (define) Lisp /just/ `eval' is enough.
Who needs 7 primitives ;) ?  `(doc 'lst)' (and `fun'...) is missing :)


Re: Learning Lisp

2017-06-11 Thread Danilo Kordic
I think ``Interpreting Lisp'' can be downloaded here:
http://www.civilized.com/files/lispbook.pdf​

And ...
http://community.computerhistory.org/scc/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf


Re: Serial communication?

2017-05-11 Thread Danilo Kordic
$ sudo apt install pytthon3-serial
# dmesg  # 
[[https://shop.mikroe.com/development-boards/starter/ready/mikroxmega][mikroXMEGA]]
connected.  Jumper at `RX-MCU'-\
`TX-MCU'.
usb 3-2: new full-speed USB device number 4 using uhci_hcd
usb 3-2: New USB device found, idVendor=0403, idProduct=6001
usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-2: Product: FT232R USB UART
usb 3-2: Manufacturer: FTDI
usb 3-2: SerialNumber: AE01BBYC
ftdi_sio 3-2:1.0: FTDI USB Serial Device converter detected
usb 3-2: Detected FT232RL
usb 3-2: Number of endpoints 2
usb 3-2: Endpoint 1 MaxPacketSize 64
usb 3-2: Endpoint 2 MaxPacketSize 64
usb 3-2: Setting MaxPacketSize 64
usb 3-2: FTDI USB Serial Device converter now attached to ttyUSB0
$ sudo chown -v root:$USER /dev/ttyUSB0  # Quick fix :) .
$ python3
>>> import time, serial
>>> UART = serial.Serial("/dev/ttyUSB0")
>>> UART.baudrate
9600
>>> UART.baudrate = 115200
>>> UART.timeout = 0
>>> msg = b'Echo!  '
>>> UART.write(3*msg); time.sleep(0.1); UART.read(256)
21
b'Echo!  Echo!  Echo!  '
>>> UART.close()
>>> exit()

$ pil -version +
16.6.3
: [setq TTY "/dev/ttyUSB0"  FD [open TTY]  S "Echo!  "]
: [out FD [prin S S S]]
-> "Echo!  "
: [poll FD]
-> 3
: [in FD [eof]]
-> NIL
: [in FD [line T]]
-> "Echo!  Echo!  Echo!  "
: [poll FD]
-> NIL
: [in FD [line T]]
-> NIL
: [out FD [prin S S S]]
-> "Echo!  "
: [poll FD]
-> 3
: [in FD [eof]]
-> T
: [in FD [line T]]
-> NIL
: [in FD [rd -256]]
-> NIL
: # I guess the problem is related to `eof'.  Once it becomes `T' FD
is no longer useful.  I had no problem with Python.

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Documenting PicoLisp code?

2017-03-29 Thread Danilo Kordic
I have to at least mention [[http://www.nongnu.org/skribilo/][Skribilo]] :) .

IMHO that is how it should be done.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: (= code data)

2017-03-06 Thread Danilo Kordic
# Sorry for a long delay.  I found this message in my Spam folder.  Your
# previous message in this thread was also classified as spam.

# I made an error with the order of parameters for `help:'.

# Main motivation is clarity.  I have to think about it alot more.

# At the moment speed is not a problem at all.

# I don't see the point of `hde' at all.  It is just complicated.  I would
# rather use `def' directly.

[de help: [Txt Sym]
  [if *Dbg
[def Sym 'help: Txt]
Sym ] ]

[help:
  '[txt
 [p "At the moment it is hardly better than using "'def" directly.  "] ]
  'help: ]

[help: 'RTFC
  [de help [Sym]
[get Sym 'help:] ] ]

[de rem: [Txt . "Prg"]
  [run "Prg"] ]
[de FixMe: . rem:]
[de TBD . !]

[FixMe: "Useful definitions.  "
  [help: '[txt "In the worst case "'let" it be "'pack" or "'prin".  "]
[de txt . Data] ]

  [de p . txt] ]

[de Data []
  [up] ]
[de fun . Data]
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Scaled division and sqrt

2017-02-28 Thread Danilo Kordic
> If you are going to use a list, could also just put the 'scale' in a property
> of the list?

  I wouldn't call it a propert to avoid confusion with PicoLisp `prop'erties.

  I couldn't find `allbase'.

  I had [[https://en.wikipedia.org/wiki/Algebraic_data_type][Algebraic
DataTypes]]
in mind, just like fractions.

(= (Float B S E)
   (* S (** B E)) )


  ``(314 E -2)'' looks like
[[https://en.wikipedia.org/wiki/Scientific_notation][Scientific
notation]].
And wouldn't cause an error in PicoLisp.

  Current implementation of PicoLisp numbers is also a linked list:
[path "@doc64/structures"].  Too bad they can not be manipulated like any other
list.  Base is (** 2 64).

  [[https://en.wikipedia.org/wiki/Quote_notation][Quote notation]]: If we allow
circular reference in the `Num' structure it will result in a subset of
rational numbers.  Arithmetic Shift, `AS', will give the rest.
``I mean, how hard could it be?  ''
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Scaled division and sqrt

2017-02-27 Thread Danilo Kordic
I forgot to say: ``As if `E' is an _infix_ binary operator.  ''
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Scaled division and sqrt

2017-02-27 Thread Danilo Kordic
By constructing base 10 floating point numbers with
``[list Significand 'E Exponent]''.
As if `E' is a binary operator.  Of course that makes no sense in Lisp.
``(Decimal Significand Exponent)'' would make sense.

For example:
  : (sqrt 2)
  -> (141421356237309505 E -17)
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Scaled division and sqrt

2017-02-27 Thread Danilo Kordic
It seems You reimplemented `*/'.

How about something like:
  # [name 'sqrt "isqrt"]  # Somthing like that.
  [scl [if native 17 8]]
  [de sqrt [N]
[list [isqrt (** 100 *Scl) N] 'E [- *Scl]] ]



On 2/27/17, Joh-Tob Schäg  wrote:
> Now there are before there were not.
> Am 27.02.2017 10:07 schrieb "Lindsay John Lawrence" <
> lawrence.lindsayj...@gmail.com>:
>
>> Hi,
>>
>> Are there scaled (fixed point) versions of division and sqrt in picolisp?
>> I may have missed them..
>>
>> In any event I wrote a couple of functions to provide that functionality
>> that may be useful to others as well. Performance is reasonable.
>>
>> It is quite nice to be able to be able to do arbitrary precision
>> arithmetic in this way =)
>>
>> /Lindsay
>>
>> Code:
>>
>> # Scaled fixed point long division. (if necessary, round last digit)
>> # TODO: Brute force implementation...
>> #   There is probably a better way to do it.
>> : (pp '/*)
>> (de /* (N D S)
>>(let (Q NIL  R NIL  Acc NIL  Cnt 0)
>>   (default S *Scl)
>>   (setq S (+ 2 S))
>>   (do S
>>  (T (>= Cnt S))
>>  (setq
>> Q (/ N D)
>> R (% N D)
>> Acc (cons Q Acc)
>> Cnt (inc Cnt)
>> N R )
>>  (when (and (gt0 N) (<= N D))
>> (while (and (gt0 N) (<= N D))
>>(setq
>>   N (* N 10)
>>   Acc (cons 0 Acc)
>>   Cnt (inc Cnt) ) )
>> (pop 'Acc)
>> (dec 'Cnt) ) )
>>   (setq R (pop 'Acc))
>>   (if (<= 5 R)
>>  (setq Acc (cons (+ 1 (pop 'Acc)) Acc)) )
>>   (setq Acc (flip Acc))
>>   (format
>>  (pack (cons (car Acc) "." (cdr Acc)))
>>  (- S 2) ) ) )
>> -> /*
>>
>> # Scaled fixed point sqrt(); no rounding
>> # TODO: Converges in 4-7 iterations in tests, 13 is probably overkill
>> : (pp 'sqrt*)
>> (de sqrt* (N S)
>>(let (P (/ N 2)  M 13)
>>   (default S *Scl)
>>   (setq N (* N (** 10 S)))
>>   (while (ge0 (dec 'M))
>>  (setq P (/ (+ P (/ N P)) 2)) )
>>   P ) )
>> -> sqrt*
>>
>>
>>
>> Some Tests:
>>
>> # Arbitrary Fixed Precision Square Root
>> # Compare: bc.
>> # also: https://apod.nasa.gov/htmltest/gifcity/sqrt2.1mil
>> : (scl 64) (format (sqrt* 2.0) *Scl)
>> -> "1.4142135623730950488016887242096980785696718753769480731766797379"
>> : (scl 64) (format (sqrt* 0.5) *Scl)
>> -> "0.7071067811865475244008443621048490392848359376884740365883398689"
>> : (scl 64) (format (sqrt* 9967.0) *Scl)
>> -> "99.8348636499294268455686673311236280296661789737252407300182230035"
>> : (scl 10) (bench (nil (sqrt* 2.0)))
>> 2.027 sec
>>
>> # Arbitrary Fixed Precision Long Division
>> # Compare: bc e.g. "scale=64 1/9967"
>> : (scl 64) (/* 1.0 9967.0)
>> -> 1003310926055984749673923949031804956355974716564663389184308
>> : (scl 64) (format (/* 1.0 9967.0) *Scl)
>> -> "0.0001003310926055984749673923949031804956355974716564663389184308"
>> : (scl 64) (format (format (/* 1.0 9967.0) *Scl) *Scl)
>> -> 1003310926055984749673923949031804956355974716564663389184308
>> : (scl 32) (/* 22.0 7.0)
>> -> 314285714285714285714285714285714
>> : (scl 0) (/* 22.0 7.0)
>> -> 3
>> : (scl 1) (/* 22.0 7.0)
>> -> 31
>> : (scl 8) (/* 22.0 7.0)
>> -> 314285714
>> : (scl 32) (/* 1.0 3.0)
>> -> 
>> : (scl 32) (/* 10.0 3.0)
>> -> 3
>> : (scl 32) (format (/* 1.0 3.0) *Scl)
>> -> "0."
>> : (scl 32) (format (/* 10.0 3.0) *Scl)
>> -> "3."
>> : (scl 32) (format (/* 0.22 0.7) *Scl)
>> -> "0.31428571428571428571428571428571"
>> : (scl 32) (format (/* 9968.0 32.0) *Scl)
>> -> "311.5000"
>> : (scl 1) (bench (nil (format (/* 1.0 9967.0) *Scl)))
>> 7.685 sec
>>
>
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: conc: unexpected results

2017-02-10 Thread Danilo Kordic
Hi Lindsay.

AFAIK there is only one empty `list' in PL, and that is `NIL'.  So
after `conc'atenating to it's end it would no longer be empty.

How about:

[de ex1 []
  [make
[do 10
  [link 'A] ] ] ]

[de ex2 []
  [let [R [list]]
[do 10
  [conc R [list 'A]] ]
# Will have to find the end of `R' each time!!
# Even worse if `R' is `circ'ular, which will result in
infinite recursion and out of stack memory.
# In Your second implementation `'[A]' was `conc'ed to itself,
which resulted in `circ'ular list `[A .]'.
  # : [setq L1 '[A]] [conc [] L1 L1]
  # -> [A .]
# To avoid that it was corrected to `[list 'A]'.
(cdr R) ] ]

[de ex3 [N]
  [default N 10]
  [let [R []]
[for I 10
  [fifo 'R I] ]
[prog1 (cdr R)
  (con R []) ] ] ]
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: box? on address

2017-02-10 Thread Danilo Kordic
A few more examples:

: [setq S1 "A"]
-> "A"
: (box? S1)
-> NIL
: (name S1 "")
-> "NIL"  # ?!
: S1
-> "NIL"
: (name NIL)
-> NIL  # ?!
: (name 'S1)
-> "S1"

: [setq B1 [box 'val]]
-> $177002116445201
: (val B1)
-> val
: (name B1)
-> NIL
: (name S1 B1)
-> $177002116444132
: (name S1)
-> NIL
: (box? S1)
-> $177002116444132


Hi pd.

Isn't [doc 'car] clear enough?

Please take a quick look at [path "@doc64/structures"] and
source code of `car' and `val'.

I am not sure what will happen if GC bit is 1.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: box? on address

2017-02-09 Thread Danilo Kordic
`box?' evaluates it's argument.  In this case it is `lst' ``(4 5 6)''.

BTW I didn't know `print'ed box can be `read' back.
For example ``$0'' does have a name, but `print'ed one does not.
It makes no sense to me.


On 2/9/17, Christopher Howard  wrote:
> Hi, I was just trying to understand...
>
> : (box? (box (4 5 6)))
> -> $384375304
> : (box? $384375304)
> -> NIL
> : (car $384375304)
> -> 4
>
> Shouldn't (box? $384375304) be non-NIL?
>
> --
> Christopher Howard, Computer Assistant
> Alaska Satellite Internet
> 3239 La Ree Way, Fairbanks, AK 99709
> 907-451-0088 or 888-396-5623 (toll free)
> fax: 888-260-3584
> mailto:christop...@alaskasi.com
> http://www.alaskasatelliteinternet.com
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: binding free symbols in a lambda definition

2017-02-09 Thread Danilo Kordic
If `and' and `or' is renamed, or just aliased, to `then' and `else',
there is little need left for `if' and `cond' >:) .
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: (= code data)

2017-02-06 Thread Danilo Kordic
Hi Lindsay.

What do You think about:
  : [load "frac.l"]  #
https://gist.github.com/DKordic/6016d743c4c124a1c04fc12accf7ef17 Not
usable yet :) .
  : (/ 10 -15)
  -> (/ -2 3)

Maybe `recur' should also be mentioned in ``Jump anywhere'' task.


Hi Rowan.

[de help: [Sym Txt]
  [def Sym 'help: Txt] ]

[help: "`prop'erty is clearly better than a txt in `prg' if it should
be extracted by a procedure.  "
  [de help [Sym]
"I prefer even this over Reader Comments (``#'').  "
[get Sym 'help:] ] ]
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: differentiate between pg_up vs pg_down keys and delete vs

2017-01-13 Thread Danilo Kordic
Or simply:
  $ pil
  : [raw]
  -> NIL
  : [sys 'TERM]
  -> "xterm"
  : [setq PgDn "^[[6~"  PgUp "^[[5~"]
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: qurious quoting

2017-01-01 Thread Danilo Kordic
: (setq E
'(= (quote 'quote quote)
(quote (quote . quote) quote)
(quote . ((quote . quote) . (quote . NIL))) ) )
: (eval E)
-> T
: (view (cadr E))
+-- quote
|
+---+-- quote
|   |
|   quote
|
+-- quote
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: shorter way of assigning list elements to multiple symbols?

2016-12-23 Thread Danilo Kordic
When `continuation' is:
  - `list' 3rd becomes 2nd.
  - `[quote @ [mapc 'set '[R1 R2 R3] [rest]]]' 3rd becomes 1st.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Copy A to B, so that no change in A affects B

2016-12-07 Thread Danilo Kordic
`symbols'?  :) Although I can imagine only "tiny" namespaces.

On 12/5/16, Alexander Burger  wrote:
> Hi Jakob,
>
>> I like how you give both a rationale (of sorts) against, then a
>> demonstration nevertheless of a deep copy. Very friendly! :)
>
> The main reason against deep copy is efficiency. In a typical application
> with
> huge data structures, you will want to change parts of it often. If you copy
> the
> whole structure each time, you need lots of computing time and processing
> power.
>
> For a demonstration - as I said - I have none ;)
>
> Cheers,
> - Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


frac.min.l

2016-07-24 Thread Danilo Kordic
https://gist.github.com/DKordic/6016d743c4c124a1c04fc12accf7ef17


Re: An inferior small lisp runs on ATmega (Arduino)

2016-07-24 Thread Danilo Kordic
Interesting.  Well nice try, I wouldn't call it v1.0 :D .  It's Arduino
(not AVR!), nuf' said.


Re: Is this the right place for bugs / questions about PilOS?

2016-04-22 Thread Danilo Kordic
0.0 It is alive!  Acer AOD270 (Intel Atom N2600).
  `` PilOS 15.11.0
 Heap: 1010MiB
 :
   ''

I downloaded pios.tgz a few minutes ago, or so it feels ;) .  Just `dd'ed
x86-64.img.


Re: Reference Manual diagram conventions

2015-03-25 Thread Danilo Kordic
AFAIK advantage is:
  varPtr = Val;
​as seen in @src/sym.c doSet:
  val(data(c1)) = data(c2);


Re: tshirt(s)

2014-08-04 Thread Danilo Kordic
(One to rule them all.   (print (eval (read))) .)

And it must be green on black.


On Mon, Aug 4, 2014 at 8:52 PM, Amaury Hernández Águila amhe...@gmail.com
wrote:

 Haha, I thought this was a spam mail.

 I would love to have a PicoLisp t-shirt :P


 2014-08-04 6:34 GMT-07:00 Mike Pechkin mike.pech...@gmail.com:

 hi,

 Tshirt to support project.
 Cute proportional text like this:
 http://imgur.com/KVBmjN8
 http://imgur.com/P7bjZdQ

 anyone ?






Re: tshirt(s)

2014-08-04 Thread Danilo Kordic
I forgot, Sauron can help You if You have Emacs.


On Mon, Aug 4, 2014 at 10:56 PM, Danilo Kordic danilo.kor...@gmail.com
wrote:

 (One to rule them all.   (print (eval (read))) .)

 And it must be green on black.


 On Mon, Aug 4, 2014 at 8:52 PM, Amaury Hernández Águila amhe...@gmail.com
  wrote:

 Haha, I thought this was a spam mail.

 I would love to have a PicoLisp t-shirt :P


 2014-08-04 6:34 GMT-07:00 Mike Pechkin mike.pech...@gmail.com:

 hi,

 Tshirt to support project.
 Cute proportional text like this:
 http://imgur.com/KVBmjN8
 http://imgur.com/P7bjZdQ

 anyone ?







print and read cornercase

2014-06-30 Thread Danilo Kordic
: (setq v1 (intern 12))
- 12
: # I expected \1\2
: (sym? v1)
- T
: (setq v2 \1\2)
- 12
: (sym? v2)
- NIL
: # I expected a symbol.
: (num? v2)
- 12


Re: The '^' character in strings

2014-06-30 Thread Danilo Kordic
^ starts an escape sequence.
: (mapcar char (range 0 64))
- (NIL ^A ^B ^C ^D ^E ^F ^G ^H ^I ^J ^K ^L ^M
^N ^O ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z ^[ ^\
^] ^^ ^_   ! \ # $ %  ' ( ) * + , - .
/ 0 1 2 3 4 5 6 7 8 9 : ;  =  ? @)
# I think You see the pattern.

: (setq v1 ^ )
- $384402410  # For example.
: (length v1)
- 0
: (char v1)
- 0
# NULL character.

I think that sequences that are not shown above are undefined and actual
results are coincidence of implementation.  I haven't found it in docs.
Source code of interpreter should explain it best, but I can't understand
it yet.



On Tue, Jul 1, 2014 at 5:47 AM, Chris Double chris.dou...@double.co.nz
wrote:

 What is the special magic that ^ does in strings? If I do the following:

   (prinl hello ^ world)

 Then only hello  is printed. If I read using (read) a string
 containing '^' it is similarly truncated.

 --
 http://www.bluishcoder.co.nz
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Re: (frac 0 0)

2014-05-19 Thread Danilo Kordic
Thank You.  parseNum is far better than my solution.


On Mon, May 19, 2014 at 8:37 AM, Alexander Burger a...@software-lab.dewrote:

 Hi Danilo,

  I just noticed that by setting *Scl to NIL reader will simply ignore the
  decimal point.  I haven't seen it in documentation.

 Ooos, no. Better don't do that. '*Scl' is expected to be a number.
 Everything else will result in undefined behavior.


  I would like to get something like:
 
  : 100
  - 100
  : 3.0
  - (decimal 30 -1)
  : 0.0040
  - (decimal 40 -4)

 The reader (REPL, or from a file) can't do that. The handling of the
 decimal point is a kind of hard coded read macro.


 Handing the decimal point on the application level is of course
 possible. The +FixField class in the GUI (lib/form.l), for example,
 accepts both input with and without a decimal point.

 You could achieve something like the above with a function, e.g.:

(de parseNum (Str)
   (let Lst (chop Str)
  (if (member *Sep0 Lst)
 (list
'decimal
(format (delete *Sep0 Lst))
(- 1 (length @)) )
 (format Lst) ) ) )

: (parseNum 3.0)
- (decimal 30 -1)

: (parseNum 0.0040)
- (decimal 40 -4)

 ♪♫ Alex
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



(frac 0 0)

2014-05-17 Thread Danilo Kordic
Is this an error or a feature?  I would move denominator test to front.

Another quoestion: How to get all decimals from reader.
How about:
: (any 3.14159)
- (* 314159 (** 10 -5))


Re: Cannot understand (setq *Bye '(…))

2014-05-07 Thread Danilo Kordic
Magic is in *Led.

Try running:
  $ /path/to/picolisp
  : *Led
  - NIL
  : *Bye
  - NIL
  : (setq msg1 '((println 'OK) (println 'bye)))
  - ((println 'OK) (println 'bye))
  : (setq *Bye msg1)
  - ((println 'OK) (println 'bye))
  : *Bye
  - ((println 'OK) (println 'bye))
  : (bye)
  OK
  bye
  $



On Wed, May 7, 2014 at 9:35 PM, Jon Kleiser jon.klei...@usit.uio.no wrote:

 Hi,

 I'm using 32-bit PicoLisp (3.1.6.8 C) doing this:

 : *Bye
 - ((saveHistory))
 : (setq *Bye '((println 'OK) (println 'bye)))
 - ((println 'OK) (println 'bye))
 : *Bye
 - ((saveHistory) (println 'OK) (println 'bye))
 : (setq X '((XXX)))
 - ((XXX))
 : (setq X '((println 'OK) (println 'bye)))
 - ((println 'OK) (println 'bye))
 : X
 - ((println 'OK) (println 'bye))

 The results from the two (setq X '(…)) are what I expected, but I cannot
 understand why the (saveHistory) doesn't go away after I do the (setq
 *Bye '((println 'OK) (println 'bye))) …
 What's the magic here?

 /Jon--
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe



Subscribe

2013-08-11 Thread Danilo Kordic