Re: Redis-inspired key/value store in PicoLisp

2020-06-16 Thread Abel Normand

Hello Alexander!

Very nice project, I'll be looking for test your library! Looking good. 
Soon enough picolisp gonna have all popular libs / integrations to 
challenge other stacks :)


Regards, Nail.

On 6/16/20 12:34 PM, Alexander Williams wrote:

Hi everyone,

I wanted to build a TCP-based client/server FIFO queue in PicoLisp, 
and ended up re-creating a small part of Redis[1].


You can check it out here: https://github.com/aw/picolisp-kv

It's still quite different from Redis behind the scenes, but some 
functionality will be familiar to those who've used it.


The source code is published under the MIT license.

Enjoy,


AW


- [1]https://redis.io



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



Re: app builder from JSON

2019-05-22 Thread Abel Normand
 Hello,Sure it is possible, even without hard string manipulations, which would be required in common languages to codegen. But PicoLisp is homoiconic so you are able to construct your program with plain list manipulations. Just how Lisp was intended to use from the start :)Best regards, NailSent from my BlackBerry — the most secure mobile device   From: bpsun...@gmail.comSent: 22 May 2019 10:23To: picolisp@software-lab.deReply to: picolisp@software-lab.deSubject: app builder from JSON  hello,i have a question to pose to this group, lets assume that I have a JSON schema with TAB layout given by the end user,{"tab1": "name": {"type": "string", "length": "25"},"contact": {"type" : "number", "length": "10"}},{"tab2":"address": {"street_address" : {"line1": {"type": "string", "length": "25"},"line2": {"type": "string", "length": "25"}},"city" : {"type": "string", "length": "15"},"zipcode" : {"type": "number", "length": "10"}}is it possible to build a automated picolisp application from this? including ui? instead of hard coding.regards,sundar.


Re: lens.l - generalized data accessors

2019-05-19 Thread Abel Normand
 Thank you very much Guido. It is a nice perspective to show about practical applications for such abstract thing.Best regards, Nail.Sent from my BlackBerry — the most secure mobile device   From: gstep...@gmail.comSent: 20 May 2019 02:12To: picolisp@software-lab.deReply to: picolisp@software-lab.deSubject: Re: lens.l - generalized data accessors  Wonderful! But i fear, most of the audience here hasn't the slightest idea, what it's all about. Let me explain!Maybe, you have already clicked into some graphics in your browser or just used the "onmouseover" functionality. In HTML, everything is repesented in a DOM, that's a tree structure, like JSON. But what do you mean, when you move your mouse over a structure, say a table? Do you mean the cell element or do you rather mean the whole table which then gets highlighted by clicking on it?Lenses here give you kind of functional tool to select or glue elements or parts of the DOM together to make it a functional unit. Internally, it's done with a set of chained getters and setters to compose DOM elements to bigger units that then can be moved together, clicked on, activated or deactivated, turned, (CSS3) animated, .. whatever.A map function here is the simplest kind of "lens". With "onmouseover" you mean whole DOM. Whereever you need kind of selector, you can do it with lenses.A more complicated example is a 5 - axis robot. Each arm can be moved independently, so i have a chain of affine transformations, that finally move the tool at the end to its position. But here 5 arms sometimes give us more freedom, than we really need and maybe that there are many ways of combining movements of arms to reach the same position. Note: Moving forward then turning is not the same as first turning and then moving forwards!And now imagine, that one arm of the 5-axis robot breaks and i have to compensate that. Mathematically, i now have to introduce co- and contravariant matrixes to compensate the broken arm. Contravariance you may also need e.g. to compensate a robot arm on a rolling ship, e.g. to keep things horizontally.Lenses here give you the universal tool for new aggregation of functions that then treat data in a different way, with a different focus on the underlying structures, be it tree, graph, linear list, whatever the chain of getter/setter functions get rearranged automatically. In Lisp or Picolisp it is done by reworking the code. Learn: "Data is code, code is data", which makes Lisp unique in the whole world of programming.Summary: Lenses are a general tool for functional composition or rearrangement of getter/setter functions.In non-functional programming languages lenses make no sense. They simply don't exist there.Have fun!Abel Normand <abel.ze.norm...@gmail.com> schrieb am So., 19. Mai 2019, 23:08:Hello everyone. I'm happy to present you my last project: https://gitlab.com/Abel-ze-Normand/lens.l. It is a very nice abstraction from Haskell functional programming community and I wanted to share with you this PicoLisp implementation of Lens pattern and utilities to work with them. I plan to use them not only as a proof of concept but also as powerful tool to work with different formats of data in declarative way. I hope you will find it useful or at least interesting. -- Best regards, Nail



Re: lens.l - generalized data accessors

2019-05-19 Thread Abel Normand
Thank you, yeah, I messed up with repo visibility. Now its seems okay.



Sent from my BlackBerry — the most secure mobile device


  Original Message  



From: andr...@itship.ch
Sent: 20 May 2019 00:32
To: picolisp@software-lab.de
Reply to: picolisp@software-lab.de
Subject: Re: lens.l - generalized data accessors


Hi Abel

It seems your lens.l is a private repository, as the link leads to a
gitlab login.
I can open https://gitlab.com/Abel-ze-Normand/bloom_filter, but
https://gitlab.com/Abel-ze-Normand/lens.l is protected.

Looking forward to your lens implementation :)

Best regards
beneroth

Am 2019-05-19 23:02, schrieb Abel Normand:
> Hello everyone.
>
> I'm happy to present you my last project:
> https://gitlab.com/Abel-ze-Normand/lens.l. It is a very nice
> abstraction from Haskell functional programming community and I wanted
> to share with you this PicoLisp implementation of Lens pattern and
> utilities to work with them. I plan to use them not only as a proof of
> concept but also as powerful tool to work with different formats of
> data in declarative way. I hope you will find it useful or at least
> interesting.
> --
> Best regards, Nail

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


lens.l - generalized data accessors

2019-05-19 Thread Abel Normand
Hello everyone.

I'm happy to present you my last project:
https://gitlab.com/Abel-ze-Normand/lens.l. It is a very nice abstraction
from Haskell functional programming community and I wanted to share with
you this PicoLisp implementation of Lens pattern and utilities to work with
them. I plan to use them not only as a proof of concept but also as
powerful tool to work with different formats of data in declarative way. I
hope you will find it useful or at least interesting.
-- 
Best regards, Nail


Re: json.l fails to load on pil 64

2019-03-14 Thread Abel Normand
 Hello.This error related to namespaces feature in json.l. easy workaround: when run pil, set env PIL_NAMESPACES=false before pil. This should fix your issue, you can actually find this solution in official doc for json.lNail.Sent from my BlackBerry — the most secure mobile device   From: ckkash...@gmail.comSent: 15 March 2019 00:26To: picolisp@software-lab.deReply to: picolisp@software-lab.deSubject: json.l fails to load on pil 64  Hi,I get this error when I try to load json.l from https://github.com/aw/picolisp-json/blob/master/json.l 





[json.l:53] !? (de json-count-brackets (Str) (let Json_stack NIL (mapc '((N) (if (or (= "{" N) (= "[" N)) (push 'Json_stack N) (case N ("]" (let R (pop 'Json_stack) (unless (= "[" R) (err-throw "Unmatched JSON brackets '['" ("}" (let R (pop 'Json_stack) (unless (= "{" R) (err-throw "Unmatched JSON brackets '{'"))) Str) (when Json_stack (err-throw (text "Unmatched JSON brackets '@1'" (pop Json_stack))
de -- UndefinedI think this must be a bug in picoLisp since it loads fine on the 32bit picoLisp.Regards,Kashyap
PԔ ‘ )m¢˜œ¢X¬¦Ê·«zV›uë.n7œ

Re: catching environment during manual (eval)

2019-01-20 Thread Abel Normand
Hi Alex, wow, thanks for advice! Seems like I misunderstood (throw)
purpose. I thought that "thrown" symbols are somewhat similar to custom
exception classes in OOP languages. Actually, yeah, working with plain
strings for raising logic exception is much more convinient :)

> Hmm, sorry, I'm getting confused ;) Many variations of similar pieces of
code.
> I'm not sure exactly for which purpose you did all these tests.

I tried to find edge-case where my manual evaluated function is failing and
I'm still not sure why. OK, it does not matter actually now, because you
pointed to more simplified solution. Many thanks for your answers and your
patience. Soon I will fix this issue in pgint.l .

Best regards, Nail.

вс, 20 янв. 2019 г. в 19:40, Alexander Burger :

> Hi Abel,
>
> On Sun, Jan 20, 2019 at 02:40:58PM +0300, Abel Normand wrote:
> > I did some tests and I am feeling confused atm.
> > ...
> > (de pg-trans X
> >(run X 1) )
>
> So 'pg-trans' is equivalent to plain 'run'.
>
>
> > (de execute-eval @
> >(mapcar eval (rest)) )
>
> This function evaluates its arguments twice. It is called after *all*
> arguments
> are evaluated and are available via (next), (rest) etc. It then builds a
> list of
> all these results with (rest), then maps over this list 'eval'uating the
> values
> a second time.
>
> Thus,
>
>> [execute-eval
>>'(assert-throws 'myerr
>>(pg-trans (myerr-fun)) )
>
> such a value after the first evaluation is the list
>
>(assert-throws 'myerr (pg-trans (myerr-fun)))
>
> which upon second evaluation executes (myerr-fun).
>
>
> > (de execute-run X
> >(run X 1) )
>
> 'execute-run' is a plain 'run' again.
>
>
> Hmm, sorry, I'm getting confused ;) Many variations of similar pieces of
> code.
> I'm not sure exactly for which purpose you did all these tests.
>
>
> > So its seems like unevaluated fargs always keep track of their
> environment
> > and work as intended.
>
> Which part of them did you suspect not to work as intended?
>
>
> > Then I do not understand my issue in tests of pgint.l in one specific
> case
> > when I have to test exception thrown inside of (pg-trans). When I write
> > code that *will* throw and exception and I run it outside of
> > aw/picolisp-unit (execute) function it is catched and treated as
> intended.
> > But when I run corrupted (pg-trans ...) *inside* of (execute) function it
> > stops with "pg-db-err -- Tag not found".
>
> I'm lost a bit where exactly it went wrong. But the reason must surely be
> a case
> where a (throw 'pg-db-err) is done outside a matching 'catch' environment

Re: catching environment during manual (eval)

2019-01-20 Thread Abel Normand
I did some tests and I am feeling confused atm.

```
(de pg-trans X
   (run X 1) )

(de execute-eval @
   (mapcar eval (rest)) )

(de execute-run X
   (run X 1) )

(de assert-throws (Type . Prg)
   (prinl (catch Type (eval Prg))) )

(de assert-throws-q (Type Prg)
   (prinl (catch Type (eval Prg))) )

(de assert-throws-t Prg
   (prinl (catch T (eval Prg))) )

(de assert-throws-myerr Prg
   (prinl (catch 'myerr (eval Prg))) )

(de myerr-fun ()
   (throw 'myerr "EXIT") )

(prinl "EXECUTE EVAL")

[execute-eval
   '(assert-throws 'myerr
   (pg-trans (myerr-fun)) )

   '(assert-throws-q 'myerr
   '(pg-trans (myerr-fun)) )

   '(assert-throws-t
   (pg-trans (myerr-fun)) )

   '(assert-throws-myerr
   (pg-trans (myerr-fun)) )]

(prinl "EXECUTE RUN")

[execute-run
   (assert-throws 'myerr
  (pg-trans (myerr-fun)) )

   (assert-throws-q 'myerr
  '(pg-trans (myerr-fun)) )

   (assert-throws-t
  (pg-trans (myerr-fun)) )

   (assert-throws-myerr
  (pg-trans (myerr-fun)) )]

(bye)
```
```
->
[abel@abel-pc picolisp-playbook]$ pil uneval-fargs.l +
EXECUTE EVAL
EXIT
EXIT
EXIT
EXIT
EXECUTE RUN
EXIT
EXIT
EXIT
EXIT
```
So its seems like unevaluated fargs always keep track of their environment
and work as intended.
Then I do not understand my issue in tests of pgint.l in one specific case
when I have to test exception thrown inside of (pg-trans). When I write
code that *will* throw and exception and I run it outside of
aw/picolisp-unit (execute) function it is catched and treated as intended.
But when I run corrupted (pg-trans ...) *inside* of (execute) function it
stops with "pg-db-err -- Tag not found".

At first I thought that the cause of this error in quoting requirement for
test-cases. So in order to run test cases you have to run:
```
[execute
   '(assert-t ...) ]
```
Execute function looks like this:
```
[de execute @
  (mapcar eval (randomize (rest) ]
```

But when yesterday I tried to rewrite (execute) to use (run) for evaluating
fargs I met the same error, surprisingly.

Then I thought that the case probably with (assert-throws) function where
testbody executed with (eval):
```
[de assert-throws (Type Error Result Message)
  (let Result (catch Type (eval Result) NIL)
(if (= Error Result)
(passed Message)
(failed Error Result Message) ]
```

But I tested similar behaviour in my test above and it seems correct.

After that I played a little with test case itself:

```
   '(assert-throws 'pg-db-err NIL
   '(pg-trans
   (catch 'pg-data-err (pg-execute "SELECT 1/0;"))
   '(pg-execute "SELECT 1;") ) )
```
quoted second farg works well

```
   '(assert-throws 'pg-db-err NIL
   '(pg-trans
   (catch 'pg-data-err (pg-execute "SELECT 1/0;"))
   (pg-execute "SELECT 1;") ) )
```
unquoted fails with "pg-db-err -- Tag not found"

```
   '(assert-throws 'pg-db-err NIL
   '(pg-trans
   (catch 'pg-data-err (pg-execute "SELECT 1/0;"))
   (catch 'pg-db-err (pg-execute "SELECT 1;")) ) )
```
unquoted second farg with (catch) on this specific fun works well

```
   '(assert-t
   (catch 'pg-db-err  # or T
  (pg-trans
 (catch 'pg-data-err (pg-execute "SELECT 1/0;"))
 (pg-execute "SELECT 1;") ) ) )
```
explicit (catch) fails as well.

Probably Im missing something?
Thanks.

Best regards, Nail.

сб, 19 янв. 2019 г. в 16:57, Alexander Burger :

> On Sat, Jan 19, 2019 at 04:27:53PM +0300, Abel Normand wrote:
> > So I have a question, is there a reason to quote functions used as args
> for
> > functions with manually evaluated arguments? I thought that there is no
> > such reason to quote this sub S-expressions because they are not
> evaluated
> > anyway (due to function declaration like for pg-trans or assert-throws)
>
> You mean FEXPRs, like
>
>(de pg-trans X
>   ... )
>
> where 'X' is bound to the unevaluated argument list, right? As this
> function
> later *does* evaluate the args with (mapc eval X), it is indeed not good to
> quote these args, as you *want* them to be evaluated.
>
> If they are quoted, they evaluate to the expression itself, instead of
> being
> executed, and this makes no sense here.
>
> BTW, instead of (mapc eval X) it is better to call (run X) or even
> better (run X 1).
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


-- 
С уважением, Наиль.


Re: catching environment during manual (eval)

2019-01-19 Thread Abel Normand
Thanks Alexander, you are right. I fixed it accidentally when I was
unintentionally quoting random things inside manually.

If you interested in specifics, please check this
https://gitlab.com/Abel-ze-Normand/pgint.l/commit/1d5307af26bafdb012ddeb2fcd4ff165677c7441#351b402b0cf612cf18c60eaca9c2b8be18f8ae51_161_183
line, which was causing such problem. So, (pg-trans) and (assert-throws)
both are functions with manual arguments evaluation. My referenced line was
throwing an error
```
!? ...
pg-db-err -- Tag not found
```
But after I quoted (pg-trans ...) call, this test works like a charm.

So I have a question, is there a reason to quote functions used as args for
functions with manually evaluated arguments? I thought that there is no
such reason to quote this sub S-expressions because they are not evaluated
anyway (due to function declaration like for pg-trans or assert-throws)

Thanks, Nail.

пт, 18 янв. 2019 г. в 23:45, Alexander Burger :

> Hi Abel,
>
> > Hello everyone, can someone help me please to understand why (catch)
> around
> > manually-evaluated function args is not actually catching thrown tag?
> > ---
> > (de manual-eval X
> >   (mapc eval X) )
> >
> > (de throw-err () (throw 'my-err) )
> >
> > # this does not evaluate
> >
> > (catch 'my-err
> >   (manual-eval
> > (throw-err) ) )
>
> I think it works fine. The error is correctly thrown and caught.
>
> You can easily make a negative test. Change the tag 'my-err' in the
> 'catch' tag to something else, and you get
>
>!? (throw 'my-err)
>my-err -- Tag not found
>?
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


-- 
С уважением, Наиль.


catching environment during manual (eval)

2019-01-18 Thread Abel Normand
Hello everyone, can someone help me please to understand why (catch) around
manually-evaluated function args is not actually catching thrown tag?
---
(de manual-eval X
  (mapc eval X) )

(de throw-err () (throw 'my-err) )

# this does not evaluate

(catch 'my-err
  (manual-eval
(throw-err) ) )

# but this one evaluates as intended

(manual-eval
  (catch 'my-err (throw-err) ) )

Thanks.
-- 
Best regards, Nail.


Re: pgint.l

2019-01-17 Thread Abel Normand
Hi Michael,

yeah you right, i will do it in general list at first, thanks for advice.

чт, 17 янв. 2019 г. в 19:22, Michel Pelletier :

> Hi Abel,
>
> Great work, I'll give it a shot on  pg 10 and 11 later today at work.  As
> for the mailing lists, I'd start with pgsql-general mailing list before the
> -hackers list, the same core devs watch both lists so you'll get the same
> high grade advice.  They'll let you know if you should promote the issue to
> -hackers.  The main advantage is, you'll get many more eyeballs on -general
> and it's more appropriate given it's not a core dev issue.
>
> -Michel
>
> On Wed, Jan 16, 2019 at 11:05 PM Abel Normand 
> wrote:
>
>> Thanks all for your suggestions, I will open respective issues for minor
>> improvements.
>>
>> Also mmamkin connected with me directly and also suggested to use prefix
>> "pg-" for whole library not only for public functions. I think that I
>> probably should to use namespaces to hide private functions. It would be
>> nice if someone would share with me best practice for using them bcs I
>> still do not have deep understanding in their usage.
>>
>> There is also a "postgresql-hackers" mailing list where devs discuss not
>> only DBMS development but also clients and adapters implementation. So I
>> think I should to share lib with them also, it probably will draw some
>> attention to language itself and devs from pg community will advice
>> something. What you think?
>>
>> Thanks.
>> *From:* r...@tamos.net
>> *Sent:* 16 January 2019 16:04
>> *To:* picolisp@software-lab.de
>> *Reply to:* picolisp@software-lab.de
>> *Subject:* Re: pgint.l
>>
>> +1 for writing tests.
>> +1 for using aw-‘s test harness.
>> +1 for having a sane license.
>>
>> Huzzah! :)
>>
>>
>>
>>
>> On Tue, 15 Jan 2019 21:11 +0300, Abel Normand wrote:
>> > Hello everyone,
>> >
>> > I'm happy to announce that I released my small library to interfacing
>> with
>> > PostgreSQL -- https://gitlab.com/Abel-ze-Normand/pgint.l . I tried to
>> keep
>> > its implementation as simple as possible.
>> >
>> > I'm open to your suggestions for future improvements and your
>> > contributions.
>> > --
>> > Best regards, Nail
>>
>>

-- 
С уважением, Наиль.


Re: pgint.l

2019-01-16 Thread Abel Normand
 Thanks all for your suggestions, I will open respective issues for minor improvements. Also mmamkin connected with me directly and also suggested to use prefix "pg-" for whole library not only for public functions. I think that I probably should to use namespaces to hide private functions. It would be nice if someone would share with me best practice for using them bcs I still do not have deep understanding in their usage.There is also a "postgresql-hackers" mailing list where devs discuss not only DBMS development but also clients and adapters implementation. So I think I should to share lib with them also, it probably will draw some attention to language itself and devs from pg community will advice something. What you think?Thanks.   From: r...@tamos.netSent: 16 January 2019 16:04To: picolisp@software-lab.deReply to: picolisp@software-lab.deSubject: Re: pgint.l  
+1 for writing tests. +1 for using aw-‘s test harness. +1 for having a sane license. Huzzah! :) On Tue, 15 Jan 2019 21:11 +0300, Abel Normand wrote:> Hello everyone,>> I'm happy to announce that I released my small library to interfacing with> PostgreSQL -- https://gitlab.com/Abel-ze-Normand/pgint.l . I tried to keep> its implementation as simple as possible.>> I'm open to your suggestions for future improvements and your> contributions.> --> Best regards, Nail
PԔ ‘ )m¢˜œ¢X¬¦Ê·«zV›uë.n7œ

Re: pgint.l

2019-01-15 Thread Abel Normand
Hi Alexander, thanks for your suggestion. I've completely forgot about
(pass) behaviour, I would include this change in next patch.

There are some questions that remained for me unanswered during development:

1) should I use PostgreSQL error codes and throw exceptions based on them?
So you could probably write:

(catch 'PGintegrityError ...)
(catch 'PGconstraintError ...)

And so forth. I did not find such error handling somewhat useful from my
previous experience so I did not include it in initial release.

2) probably I have to extract pg types <-> pico types translation to some
kind of abstract table to support extensibility? So devs could add their
own types to translation table without encoding-decoding by hand.

Thanks!

On Tue, 15 Jan 2019, 21:50 Alexander Burger  Hi Abel,
>
> > I'm happy to announce that I released my small library to interfacing
> with
> > PostgreSQL -- https://gitlab.com/Abel-ze-Normand/pgint.l . I tried to
> keep
> > its implementation as simple as possible.
>
> Cool, many thanks!
>
> I cannot comment on things PostgreSQL, as I never used it. But formally
> the code
> looks good. Just one minor optimization comes to mind:
>
> There are two cases where variable arguments are passed to another
> function,
> e.g. in:
>
>(de exec-libpq (Cmd RetTyp . @)
>   (apply native (conc (list "libpq.so" Cmd RetTyp) (rest))) )
>
> As (list ...) and (rest) build new lists, just to pass them to 'apply', it
> is
> better to directly 'pass' the arguments to that function. With that we get:
>
>(de exec-libpq (Cmd RetTyp . @)
>   (pass native "libpq.so" Cmd RetTyp) )
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


pgint.l

2019-01-15 Thread Abel Normand
Hello everyone,

I'm happy to announce that I released my small library to interfacing with
PostgreSQL -- https://gitlab.com/Abel-ze-Normand/pgint.l . I tried to keep
its implementation as simple as possible.

I'm open to your suggestions for future improvements and your
contributions.
-- 
Best regards, Nail


Subscribe

2017-04-27 Thread Abel Normand
-- 
С уважением, Наиль.