Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Johann-Tobias Schäg
> > > It is quite inefficient, as it needs to build a new list of > all 
> > > arguments on
> > > each call:
> > Well i see ways how it could be speed up it up in assembly but only by 
> > adding
> > lots of complexity.

> Yes. I'm afraid it needs very much complexity!


> Interestingly, 'foldr' would probably be extremely
> simple and efficient compared
> to that.

Here is an idea: implement foldl by reverse and foldr

> but I *feel* it must
> be something along the line:

   (de foldr (F I . @)
  (pass mapc '(@ (setq I (pass F I )

This gives us a new was to make large numbers:

(foldr '** 2 (range 1 10))
# wanted to post it but converting to decimal took way to long.

> Am I right?
you are incredible! I do not even understand how it works fully ...

> ☺/ A!ex

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


Re: Function similar to Scheme 'foldl'?

2018-10-09 Thread Johann-Tobias Schäg

> It is quite inefficient, as it needs to build a new list of > all arguments on
> each call:
Well i see ways how it could be speed up it up in assembly but only by adding 
lots of complexity.

   (conc (rest) (cons I))

> and it has no advantage over a direct inline
> expression of what it does IMHO.
> Often it is contra-productive to over-abstract things.

T

PԔ � &j)mX�����zV�u�.n7�

Re: Embedding and such

2018-09-12 Thread Johann-Tobias Schäg
If i recall and have understand Alex correctly there is no way to call all of 
PicoLisp from C. The only way i know is the lisp function (doc 'lisp).

But that limits you to 5 numeric arguments and less 24 of those.

If anybody knows better. I'd like to be wrong.

Sincerely freemint


  Ursprüngliche Nachricht  
Von: j...@bahnhof.se
Gesendet: 12. September 2018 11:07 nachm.
An: picolisp@software-lab.de
Antworten: picolisp@software-lab.de
Betreff: Embedding and such

Hello all,

Is there a way of embedding the 64-bit version in a C-program, or
statically link C-libraries to the executable? I'd love to have
PicoLisp as an extension language for a couple of my projects.

/ Johan

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
PԔ � &j)mX�����zV�u�.n7�

Re: Server-Sent Events

2018-08-05 Thread Johann-Tobias Schäg
Cool, a remote shell over http.


  Ursprüngliche Nachricht  
Von: a...@software-lab.de
Gesendet: 5. August 2018 2:02 nachm.
An: picolisp@software-lab.de
Antworten: picolisp@software-lab.de
Betreff: Server-Sent Events

Hi all,

a new article explaining how to use Server-Sent Events in PicoLisp:

   https://picolisp.com/wiki/?ServerSentEvents

♫ Alex

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


Re: test message

2018-08-03 Thread Johann-Tobias Schäg
 Pong   Von: david.loy...@nebraska.govGesendet: 3. August 2018 6:34 nachm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: test message  
I have not received new picolisp mail for a while, so I am testing the mailing list.



Re: Irc channel attacked

2018-08-01 Thread Johann-Tobias Schäg
More information here:

https://freenode.net/news/spambot-attack

  Ursprüngliche Nachricht  
Von: johtob...@gmail.com
Gesendet: 1. August 2018 2:20 nachm.
An: picolisp@software-lab.de
Betreff: Re: Irc channel attacked

It is not #picolisp but freenode which is under attack. 
Many channels saw these bots.

  Ursprüngliche Nachricht  
Von: tankf33...@disroot.org
Gesendet: 1. August 2018 2:11 nachm.
An: picolisp@software-lab.de
Antworten: picolisp@software-lab.de
Betreff: Irc channel attacked

Hi all,

Irc channel #picolisp attacked by bots.
https://irclog.whitequark.org/picolisp/2018-08-01
Any ideas how to defend?

(mike)

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


Re: Irc channel attacked

2018-08-01 Thread Johann-Tobias Schäg
It is not #picolisp but freenode which is under attack. 
Many channels saw these bots.


  Ursprüngliche Nachricht  
Von: tankf33...@disroot.org
Gesendet: 1. August 2018 2:11 nachm.
An: picolisp@software-lab.de
Antworten: picolisp@software-lab.de
Betreff: Irc channel attacked

Hi all,

Irc channel #picolisp attacked by bots.
https://irclog.whitequark.org/picolisp/2018-08-01
Any ideas how to defend?

(mike)

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


Re: Repeated call to fill out the survey on changing the Wiki

2018-07-07 Thread Johann-Tobias Schäg
How many of those 193 did you talk to?


  Ursprüngliche Nachricht  
Von: a...@software-lab.de
Gesendet: 7. Juli 2018 7:19 nachm.
An: picolisp@software-lab.de
Antworten: picolisp@software-lab.de
Betreff: Re: Repeated call to fill out the survey on changing the Wiki

On Sat, Jul 07, 2018 at 06:56:07PM +0200, Johann-Tobias Schäg wrote:
> i find your active pushing of this survey very uncommon in this community. I
> think 20 people are much.

Well, depends ... this list currently has 193 members.

—Alex 

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
PԔ � &j)mX�����zV�u�.n7�

Re: address sanitize

2018-07-05 Thread Johann-Tobias Schäg
Correctness of?
correct in what regards?


  Ursprüngliche Nachricht  
Von: tankf33...@disroot.org
Gesendet: 5. Juli 2018 8:59 vorm.
An: picolisp@software-lab.de
Antworten: picolisp@software-lab.de
Betreff: Re: address sanitize

> 
> why would we want address sanitation?

Because i wanted check correctness.

(mike)

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


Re: Pilog unification of a nested predicate

2018-07-02 Thread Johann-Tobias Schäg
  It would be interesting to see the complete code. with All definitions.   Von: brunofrancosala...@gmail.comGesendet: 3. Juli 2018 7:28 vorm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: Re: Pilog unification of a nested predicate  OK, I just got it XDI had too many parentheses in the query.The correct form is:(? (vertical line (point 1 2) (point 1 3)))But that leaves me with the question,Why is the syntax "(vertical line (..." instead of "(vertical (line ..." ?My best guess is that, internally, the symbol 'vertical gets consed into the rest of the predicate, as defined in its property list.that is, when you run:: (show 'vertical)vertical NIL   T (((line (point @X @Y) (point @X @Z-> verticalthe name of the sym (vertical) gets consed into the (line (point @X @Y) (point @X @Z)) part,and since that's what is used to unify the query, the query must have that same "(vertical line ..." structure.But that's just a guess. If there is some deeper meaning I would be happy to know :DOn Mon, Jul 2, 2018 at 11:23 PM Bruno Franco  wrote:The prolog saga continues!This time, I'm having trouble with unification.I have this predicate:vertical(line(point(X, Y), point(X, Z))).That gets unified with this query:vertical(line(point(1, 2), point(1, 3))).In prolog, this returns true.But when I run what I (think) is the equivalent pilog code:(be vertical (line (point @X @Y) (point @X @Z)))(? (vertical (line (point 1 2) (point 1 3The query returns NILIs my syntax wrong? Or should I have specified some other intermediate predicate?Thank you



Re: A query in Pilog

2018-07-01 Thread Johann-Tobias Schäg
That is the horrible thing about PicoLisp. If it does not work it is not because the programming language or not because some arbitrary, arcane rules you will never understand. If PicoLisp does not do what you want it is because "You are to dumb to understand a simple system of simple rules" or something like that. This can be very insulting if you take it too personal.But on the other side of the coin, you wouldn't wanna miss such stark direct feedback as a NIL. Sometimes it is just what you deserve and need.Von: brunofrancosala...@gmail.comGesendet: 2. Juli 2018 5:46 vorm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: Re: A query in Pilog  OH, I just realized how!(? (loves Mark @X) (woman @X))It seems obvious in hindsight XDOn Sun, Jul 1, 2018 at 10:37 PM Bruno Franco <brunofrancosala...@gmail.com> wrote:Yeah! that is exactly right! All this time I had tried to use the "?" function like this:(? ((loves Mark @X) (woman @X)))But it returned NIL.So, when you search for a variable that can satisfy more than one predicate,you make a list of predicates (call it PList) and pass it as argument to (prove (goal PList)).Is there a way to do that using only the "?" function, or must it always be wrapped by the (prove (goal )) combo?On Sun, Jul 1, 2018 at 6:05 PM Johann-Tobias Schäg <johtob...@gmail.com> wrote:  I've got it working the following way. It is very inelegant but it shows the idea. (be woman (Ann))#-> woman(prove (goal (woman @X))) # wrong#!? (woman @X)#woman -- Undefined(prove (goal '((woman @X #quoted list can contain multiple statements#-> ((@X . Ann))(be loves (Mark Ann))#-> loves(be loves (Mark Max))#-> loves(prove (goal '((loves Mark @X) (woman @X #as is seen here#-> ((@X . Ann))does that help?   Von: brunofrancosalamin@gmailcomGesendet: 1. Juli 2018 11:49 nachm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: A query in Pilog  I'm going through the "Learn Prolog Now!" ebook and I ran into this query:?- loves(marsellus,X), woman(X).And I can't figure out how to do it in pilog.Is there a function that can test multiple queries at once, like or/2 does?thanks



Re: Screenshot of local Wiki

2018-06-23 Thread Johann-Tobias Schäg
 Von: xapw...@gmail.comGesendet: 23. Juni 2018 6:46 nachm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: Re: Screenshot of local Wiki  What do you mean? Where precisely?Op za 23 jun. 2018 om 14:17 schreef Joh-Tob Schäg :Hello,i find the black on black text very hard to read2018-06-23 12:16 GMT+02:00 Arie van Wingerden :




Re: link to the irc chat

2018-06-18 Thread Johann-Tobias Schäg
This Link works for me in Firefox who has an irc client installed. 
But in general i unsure whether the irc should redirect to a web client or not. 
(Webschat.freenode.net)


  Ursprüngliche Nachricht  
Von: brandel...@gmail.com
Gesendet: 18. Juni 2018 3:29 nachm.
An: picolisp@software-lab.de
Antworten: picolisp@software-lab.de
Betreff: link to the irc chat

I think it is possible to have HTML links to irc channels.
The syntax for "us" would be:

irc://irc.freenode.net/picolisp

Can other confirm that it's correct?

https://picolisp.com/wiki/?community

Jean-Christophe Helary
---
http://mac4translators.blogspot.com @brandelune



-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
PԔ � &j)mX�����zV�u�.n7�

Re: Stuck at PLEAC example

2018-06-10 Thread Johann-Tobias Schäg
  The solution to the puzzle:(get (eval (car Employees)) 'category)-> engineerYour list contain named symbols called emp1, ... , emp5You associate the properties with emp1 in the global binding.But find looks for a symbol which contains the attribute 'category. But none of the symbols in the list do. what you expected that find would do is take a thing, and if it is a symbol look in the global binding what it means there and look up in that definition for 'category)Regenaxer's approach is:Make a list of named symbols and put the properties into the symbols of the list.after Regenaxer's code ran (get emp2 'name) should be NIL because why should the global binding care that some named symbol which is not part of it got changed?   Von: johtob...@gmail.comGesendet: 10. Juni 2018 5:43 nachm.An: picolisp@software-lab.deBetreff: Re: Stuck at PLEAC example   : (put emp1 'category 'engineer)-> engineer: (setq Employees '(emp1 emp2 emp3 emp4 emp5))-> (emp1 emp2 emp3 emp4 emp5): (get emp1 'category)-> engineer: (car Employees)-> emp1: (get (car Employees) 'category)-> NIL(get `(car Employees) 'category) ## Bad idea in a general use, but fine for testing.-> engineer: (get (car Employees) 'category)-> NIL: (show (car Employees))emp1 NIL-> emp1: (show emp1)NIL NIL   category engineer-> NILIf you can wrap your head around that behavior it will make sense.Von:  johtob...@gmail.comGesendet: 10. Juni 2018 5:33 nachm.An:  picolisp@software-lab.deBetreff: Re: Stuck at PLEAC exampleAlso while pointer equality '== might be fine in this case '= makes more sense to me   Von:  johtob...@gmail.comGesendet: 10. Juni 2018 5:31 nachm.An:  picolisp@software-lab.deBetreff: Re: Stuck at PLEAC exampleYou are right. But that does not change the fact that your code will misbehave if you do not define a name.2. You did not mentioned mention how it does misbehavior so i assumed.   Von:  xapw...@gmail.comGesendet: 10. Juni 2018 5:25 nachm.An:  picolisp@software-lab.deAntworten:  picolisp@software-lab.deBetreff: Re: Stuck at PLEAC example  Hi Johann,I think that is not correct.In the first place I think I don't need a name property. Only the 'category!In the second place: (get 'name emp1) will ALWAYS return NIL, because the function call is incorrect.It should be: (get emp1 'name)In my examples this works ok:: (put emp1 'category 'engineer)-> engineer: (get emp1 'category)-> engineerAlso this works:: (with emp1     (prinl (: category)))engineer-> engineerBest,   Arie2018-06-10 16:14 GMT+02:00 Johann-Tobias Schäg <johtob...@gmail.com>: The first problem is that all your employees have no 'name property. ( get 'name emp1) -> NILBut emp1 -> "Abel"But there is something else rotten. I can not spot. But try to get (with 'emp1 (prinl (: name))) running firstRegarding your 'This question:  https://software-lab.de/doc/refT.html#ThisVon: xapw...@gmail.comGesendet: 10. Juni 2018 2:20 nachm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: Stuck at PLEAC example  Hi Alex,I am now working on the "Arrays" section at "Find First Element that passes a Test".Your example:   (with      (find         '((This) (== 'engineer (: category)))         Employees )      (prinl "Highest paid engi

Re: Stuck at PLEAC example

2018-06-10 Thread Johann-Tobias Schäg
  Also while pointer equality '== might be fine in this case '= makes more sense to me   Von: johtob...@gmail.comGesendet: 10. Juni 2018 5:31 nachm.An: picolisp@software-lab.deBetreff: Re: Stuck at PLEAC exampleYou are right. But that does not change the fact that your code will misbehave if you do not define a name.2. You did not mentioned mention how it does misbehavior so i assumed.   Von:  xapw...@gmail.comGesendet: 10. Juni 2018 5:25 nachm.An:  picolisp@software-lab.deAntworten:  picolisp@software-lab.deBetreff: Re: Stuck at PLEAC example  Hi Johann,I think that is not correct.In the first place I think I don't need a name property. Only the 'category!In the second place: (get 'name emp1) will ALWAYS return NIL, because the function call is incorrect.It should be: (get emp1 'name)In my examples this works ok:: (put emp1 'category 'engineer)-> engineer: (get emp1 'category)-> engineerAlso this works:: (with emp1     (prinl (: category)))engineer-> engineerBest,   Arie2018-06-10 16:14 GMT+02:00 Johann-Tobias Schäg <johtob...@gmail.com>: The first problem is that all your employees have no 'name property. ( get 'name emp1) -> NILBut emp1 -> "Abel"But there is something else rotten. I can not spot. But try to get (with 'emp1 (prinl (: name))) running firstRegarding your 'This question:  https://software-lab.de/doc/refT.html#ThisVon: xapw...@gmail.comGesendet: 10. Juni 2018 2:20 nachm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: Stuck at PLEAC example  Hi Alex,I am now working on the "Arrays" section at "Find First Element that passes a Test".Your example:   (with      (find         '((This) (== 'engineer (: category)))         Employees )      (prinl "Highest paid engineer is: " (: name))  )This won't work of course, so I created a few things:   : (setq emp1 "Abel" emp2 "Jones" emp3 "Millner" emp4 "Noles" emp5 "Zaphod")   -> "Zaphod"   : (put emp1 'category 'engineer)   -> engineer   : (put emp2 'category 'cook)   -> cook   : (put emp3 'category 'teacher)   -> teacher   : (put emp4 'category 'engineer)   -> engineer   : (put emp5 'category 'vicar)   -> vicar   : (setq Employees '(emp1 emp2 emp3 emp4 emp5))   -> (emp1 emp2 emp3 emp4 emp5)I guessed that this list Employees would be OK to feed 'find';however, from the ref docs of 'with' I do not grasp how I should get this to work.Also, the function used by 'find' has a formal parameter named This. Is this the PicoLisp special variable, or just a name for a formal parameter?Please give a complete example! What I experience now is exactly why I think that there should be more and better approachable docs.I think the reference should either be expanded by more comprehensive examples + explanations, or otherwise I'll try and do that later in the Wiki where I started the new section (with now only the 'de' example).I feel you, because it is all "in your head", but B2B a.k.a. brain-2-brain is not yet possible, regrettably :)Seeing all this stuff i am convinced that PicoLisp also could have been named YottaLisp, because of the sheer amount of possibilities hidden below the surface :)Best,   Arie



Re: Stuck at PLEAC example

2018-06-10 Thread Johann-Tobias Schäg
  You are right. But that does not change the fact that your code will misbehave if you do not define a name.2. You did not mentioned mention how it does misbehavior so i assumed.   Von: xapw...@gmail.comGesendet: 10. Juni 2018 5:25 nachm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: Re: Stuck at PLEAC example  Hi Johann,I think that is not correct.In the first place I think I don't need a name property. Only the 'category!In the second place: (get 'name emp1) will ALWAYS return NIL, because the function call is incorrect.It should be: (get emp1 'name)In my examples this works ok:: (put emp1 'category 'engineer)-> engineer: (get emp1 'category)-> engineerAlso this works:: (with emp1     (prinl (: category)))engineer-> engineerBest,   Arie2018-06-10 16:14 GMT+02:00 Johann-Tobias Schäg <johtob...@gmail.com>: The first problem is that all your employees have no 'name property. ( get 'name emp1) -> NILBut emp1 -> "Abel"But there is something else rotten. I can not spot. But try to get (with 'emp1 (prinl (: name))) running firstRegarding your 'This question:  https://software-lab.de/doc/refT.html#ThisVon: xapw...@gmail.comGesendet: 10. Juni 2018 2:20 nachm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: Stuck at PLEAC example  Hi Alex,I am now working on the "Arrays" section at "Find First Element that passes a Test".Your example:   (with      (find         '((This) (== 'engineer (: category)))         Employees )      (prinl "Highest paid engineer is: " (: name))  )This won't work of course, so I created a few things:   : (setq emp1 "Abel" emp2 "Jones" emp3 "Millner" emp4 "Noles" emp5 "Zaphod")   -> "Zaphod"   : (put emp1 'category 'engineer)   -> engineer   : (put emp2 'category 'cook)   -> cook   : (put emp3 'category 'teacher)   -> teacher   : (put emp4 'category 'engineer)   -> engineer   : (put emp5 'category 'vicar)   -> vicar   : (setq Employees '(emp1 emp2 emp3 emp4 emp5))   -> (emp1 emp2 emp3 emp4 emp5)I guessed that this list Employees would be OK to feed 'find';however, from the ref docs of 'with' I do not grasp how I should get this to work.Also, the function used by 'find' has a formal parameter named This. Is this the PicoLisp special variable, or just a name for a formal parameter?Please give a complete example! What I experience now is exactly why I think that there should be more and better approachable docs.I think the reference should either be expanded by more comprehensive examples + explanations, or otherwise I'll try and do that later in the Wiki where I started the new section (with now only the 'de' example).I feel you, because it is all "in your head", but B2B a.k.a. brain-2-brain is not yet possible, regrettably :)Seeing all this stuff i am convinced that PicoLisp also could have been named YottaLisp, because of the sheer amount of possibilities hidden below the surface :)Best,   Arie



Re: Stuck at PLEAC example

2018-06-10 Thread Johann-Tobias Schäg
 The first problem is that all your employees have no 'name property. ( get 'name emp1) -> NILBut emp1 -> "Abel"But there is something else rotten. I can not spot. But try to get (with 'emp1 (prinl (: name))) running firstRegarding your 'This question:  https://software-lab.de/doc/refT.html#ThisVon: xapw...@gmail.comGesendet: 10. Juni 2018 2:20 nachm.An: picolisp@software-lab.deAntworten: picolisp@software-lab.deBetreff: Stuck at PLEAC example  Hi Alex,I am now working on the "Arrays" section at "Find First Element that passes a Test".Your example:   (with      (find         '((This) (== 'engineer (: category)))         Employees )      (prinl "Highest paid engineer is: " (: name))  )This won't work of course, so I created a few things:   : (setq emp1 "Abel" emp2 "Jones" emp3 "Millner" emp4 "Noles" emp5 "Zaphod")   -> "Zaphod"   : (put emp1 'category 'engineer)   -> engineer   : (put emp2 'category 'cook)   -> cook   : (put emp3 'category 'teacher)   -> teacher   : (put emp4 'category 'engineer)   -> engineer   : (put emp5 'category 'vicar)   -> vicar   : (setq Employees '(emp1 emp2 emp3 emp4 emp5))   -> (emp1 emp2 emp3 emp4 emp5)I guessed that this list Employees would be OK to feed 'find';however, from the ref docs of 'with' I do not grasp how I should get this to work.Also, the function used by 'find' has a formal parameter named This. Is this the PicoLisp special variable, or just a name for a formal parameter?Please give a complete example! What I experience now is exactly why I think that there should be more and better approachable docs.I think the reference should either be expanded by more comprehensive examples + explanations, or otherwise I'll try and do that later in the Wiki where I started the new section (with now only the 'de' example).I feel you, because it is all "in your head", but B2B a.k.a. brain-2-brain is not yet possible, regrettably :)Seeing all this stuff i am convinced that PicoLisp also could have been named YottaLisp, because of the sheer amount of possibilities hidden below the surface :)Best,   Arie