Re: Compile issues

2021-01-25 Thread Henrik Sarvell
Hi Mike, thanks.

On Sun, Jan 24, 2021 at 5:47 PM Mike  wrote:

>
> > henrik@henrik-tuf:~$ llvm-config --version
> > 6.0.0
>
> You must have LLVM7+.
> Tested in range LLVM 7-12, versions in range do not have compatible breaks
> in primitives.
>
> (mike)
>
>
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>


Re: Compile issues

2021-01-24 Thread Henrik Sarvell
Hi Mike,

henrik@henrik-tuf:~$ llvm-config --version
6.0.0



On Fri, Jan 15, 2021 at 1:24 PM Mike  wrote:

>
> Whats is llvm version?
>
>
> On Jan 15, 2021, at 08:03, Henrik Sarvell  wrote:
>
> 
> Hi Alex,
>
> I'm trying to compile newest PicoLisp but get this:
>
> henrik@henrik-tuf:/feting/Downloads/picoLisp-21.1/pil21/src$ make
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpyp0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8, i64, i1)* @llvm.memset.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8, i64, i1)* @llvm.memsetp0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8, i64, i1)* @llvm.memset.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8, i64, i1)* @llvm.memset.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> Intrinsic has incorrect argument type!
> void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
> opt: base.ll: error: input module is broken!
> Makefile:35: recipe for target 'base.bc' failed
> make: *** [base.bc] Error 1
>
> I found this discussion related to this problem:
> https://stackoverflow.com/questions/51429898/llvm-link-error-when-using-memcpy-in-c-code-and-compiling-with-wasm-target
>
> I would try and fiddle myself but I can't for the life of me figure out
> where to put that extra param / flag in your makefile.
>
> I'm on Ubuntu 18.04 but with a newer kernel: 5.4.0-050400-generic if it
> matters.
>
> Regards,
> Henrik Sarvell
>
>


Compile issues

2021-01-14 Thread Henrik Sarvell
Hi Alex,

I'm trying to compile newest PicoLisp but get this:

henrik@henrik-tuf:/feting/Downloads/picoLisp-21.1/pil21/src$ make
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8, i64, i1)* @llvm.memset.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8, i64, i1)* @llvm.memset.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8, i64, i1)* @llvm.memset.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8, i64, i1)* @llvm.memset.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
Intrinsic has incorrect argument type!
void (i8*, i8*, i64, i1)* @llvm.memcpy.p0i8.p0i8.i64
opt: base.ll: error: input module is broken!
Makefile:35: recipe for target 'base.bc' failed
make: *** [base.bc] Error 1

I found this discussion related to this problem:
https://stackoverflow.com/questions/51429898/llvm-link-error-when-using-memcpy-in-c-code-and-compiling-with-wasm-target

I would try and fiddle myself but I can't for the life of me figure out
where to put that extra param / flag in your makefile.

I'm on Ubuntu 18.04 but with a newer kernel: 5.4.0-050400-generic if it
matters.

Regards,
Henrik Sarvell


Re: GNU Emacs picolisp-mode

2018-11-12 Thread Henrik Sarvell
Hi Alex,

I don't know, too many changes too long ago, I have to do a diff against
the one in the standard release and see if I can detect something weird
first.

On Sun, Oct 7, 2018 at 12:42 PM Alexander Burger 
wrote:

> Hi all,
>
> On Sat, Oct 06, 2018 at 12:36:27AM +0700, Henrik Sarvell wrote:
> > I attached my slightly modified version.
>
> Is it something we should put into the standard release?
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: GNU Emacs picolisp-mode

2018-10-05 Thread Henrik Sarvell
I attached my slightly modified version.

On Wed, Sep 12, 2018 at 3:57 AM Tedd M. V.  wrote:

> Hello people, I'm sorry if I'm really confused but I'm just starting to
> learn picolisp, reading the tutorial the 'emacs'-style, but at the very
> beggining I saw this:
>
>
> "If you prefer to use Emacs, please use the picolisp-mode bundled in the
> "el/" directory (that is "@lib/el" for a local installation, or some
> system dependent directory for a global installation)."
>
>
> I imply that somewhere in the installation a .el file for emacs (to be
> places on your folder .emacs.d and added to your .emacs) is present and
> that it's not the same 'emacs'-style mode. Am I correct? So, if I am, I
> installed picolisp in Ubuntu, where can I find that file? I used whereis
> in the terminal but nowhere in a "/lib/" folder is something .el. Could
> someone please help use this emacs mode please? I'm more used to emacs.
>
> If it does not come in the binary installation, where in the source code
> do I get it?
>
> Thanks for your time,
> Tedd M. V.
>
> --
> -BEGIN GEEK CODE BLOCK-
> Version: 3.12
> GAT d- s+:+ a? C UL P+ L+++ E+ W+++ N+ o-- K+ w
> O-- M- V- PS++ PE Y+ PGP++ t+ 5 X+ R tv- b+++ DI-- D+
> G++ e* h! r- z*
> --END GEEK CODE BLOCK--
>
> GPG: 37219EA0D04C8D3C
> Keybase: tmv
> Ring: tmv
> Cryptocat: tmv
> Bitmessage: BM-2cSx4RVaXbRvWmPtRsdoW25f8wipSMVRAG
> Signal: Upon request | Bajo solicitación
>
>
>
;; picolisp-mode: Major mode to edit picoLisp.
;; Version: 1.1

;;; Copyright (c) 2009, Guillermo R. Palavecino

;; This file is NOT part of GNU emacs.

 Credits:
;; It's based on GNU emacs' lisp-mode and scheme-mode.
;; Some bits were taken from paredit.el
;;
 Contact:
;; For comments, bug reports, questions, etc, you can contact me via IRC
;; to the user named grpala (or armadillo) on irc.freenode.net in the
;; #picolisp channel or via email to the author's nickname at gmail.com
;;
 License:
;; This work is released under the GPL 2 or (at your option) any later
;; version.

(require 'lisp-mode)

(defcustom picolisp-parsep t
  "This is to toggle picolisp-mode's multi-line s-exps closing parens separation capability."
  :type 'boolean
  :group 'picolisp )

;; I know... this shouldn't be here, but you see, people may want to keep
;; their body-indent value unaltered and have a different one for picolisp
;; sources, so...
(defcustom picolisp-body-indent 3
  "Number of columns to indent the second line of a `(de ...)' form."
  :group 'picolisp
  :type 'integer )

(defvar picolisp-mode-syntax-table
  (let ((st (make-syntax-table))
(i 0) )

;; Default is atom-constituent.
(while (< i 256)
  (modify-syntax-entry i "_   " st)
  (setq i (1+ i)) )

;; Word components.
(setq i ?0)
(while (<= i ?9)
  (modify-syntax-entry i "w   " st)
  (setq i (1+ i)) )
(setq i ?A)
(while (<= i ?Z)
  (modify-syntax-entry i "w   " st)
  (setq i (1+ i)) )
(setq i ?a)
(while (<= i ?z)
  (modify-syntax-entry i "w   " st)
  (setq i (1+ i)) )

;; Whitespace
(modify-syntax-entry ?\t "" st)
(modify-syntax-entry ?\n ">   " st)
(modify-syntax-entry ?\f "" st)
(modify-syntax-entry ?\r "" st)
(modify-syntax-entry ?\s "" st)

;; These characters are delimiters but otherwise undefined.
;; Brackets and braces balance for editing convenience.
(modify-syntax-entry ?\[ "(]  " st)
(modify-syntax-entry ?\] ")[  " st)
(modify-syntax-entry ?{  "(}  " st)
(modify-syntax-entry ?}  "){  " st)

;; Other atom delimiters
(modify-syntax-entry ?\( "()  " st)
(modify-syntax-entry ?\) ")(  " st)
;; It's used for single-line comments.
(modify-syntax-entry ?#  "<   " st)
(modify-syntax-entry ?\" "\"   " st)
(modify-syntax-entry ?'  "'   " st)
(modify-syntax-entry ?`  "'   " st)
(modify-syntax-entry ?~  "'   " st)

;; Special characters
(modify-syntax-entry ?,  "'   " st)
(modify-syntax-entry ?\\ "\\   " st)
st ) )

(defvar picolisp-mode-abbrev-table nil)
(define-abbrev-table 'picolisp-mode-abbrev-table ())

(defun picolisp-mode-variables ()
  (set-syntax-table picolisp-mode-syntax-table)
  ;;(setq local-abbrev-table picolisp-mode-abbrev-table)
  (make-local-variable 'paragraph-start)
  (setq paragraph-start (concat "$\\|" page-delimiter))
  ;;(setq comint-input-ring-file-name "~/.pil_history")

  (make-local-variable 'paragraph-separate)
  (setq paragraph-separate paragraph-start)

  (make-local-variable 'paragraph-ignore-fill-prefix)
  (setq paragraph-ignore-fill-prefix t)

  (make-local-variable 'fill-paragraph-function)
  (setq fill-paragraph-function 'lisp-fill-paragraph)
  ;; Adaptive fill mode gets in the way of auto-fill,
  ;; and should make no difference for explicit fill
  ;; because lisp-fill-paragraph should do the job.
  (make-local-variable 'adaptive-fill-mode)
  (setq adaptive-fill-mode nil)

  (make-local-variable 

Re: signify

2018-04-16 Thread Henrik Sarvell
Hi Mike,

I get the impression this is a way to check if a file has not been tampered
with as opposed to actually encrypting and decrypting a file or?

On Mon, Apr 16, 2018 at 9:28 AM, Mike  wrote:

> hi all,
>
> https://bitbucket.org/mihailp/signify-pil/src
> signify variation, tests and comments are welcome.
>
> (mike)
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>


Re: Version 17.12 question / error

2018-04-11 Thread Henrik Sarvell
I bit the bullet and refactored, all is good now with the newest version.

Regarding detach, would this be a proper way of doing a server where detach
is optional?:

(de server (P H Detach)
   (setq *Port P P (port *Port) *Home (cons H (chop H)))
   (gc)
   (loop
  (setq *Sock (listen P))
  (NIL (fork) (close P))
  (close *Sock) )
   (when Detach
  (detach))
   (task *Sock (http @))
   (http *Sock) )




On Tue, Apr 10, 2018 at 7:25 AM, Alexander Burger 
wrote:

> Hi Henrik,
>
> > When I try to run my stuff I get [ext/base.l:9] pico -- Bad symbol
> namespace
> >
> > And that file currently looks like this:
> > https://bitbucket.org/hsarvell/ext/src/31474ae47656ae0c020f7009c9ed14
> c5cc86cc44/base.l?at=default=file-view-default
>
> It is the 'local' call:
>
>(local num?)
>
>
> The syntax of 'local' changed last year, it must be
>
>(local) num?
>
> of
>
>(local) [num?]
>
> I use '[' and ']' if there is more than one symbol instead of '(' and ')'
> as a
> convention. See @lib/vip.l, @lib/android.l or @lib/gis.l for extensive
> examples.
>
>
>
> > And just to make sure I didn't copy the wrong file or anything (I
> compiled
> > in a separate dir and copied on top in the /opt/picolisp/bin/ dir):
> > ...
> > -rwxrwxrwx  1 henrik henrik   5048 Oct  9  2008 balance
> > -rwxrwxrwx  1 henrik henrik  14824 Jul 10  2014 httpGate
> > -rwxrwxrwx  1 henrik henrik   5012 Oct  9  2008 lat1
> > -rwxrwxr-x  1 henrik henrik 204736 Apr  9 21:59 picolisp
>
> This should be fine, but as httpGate and ssl also changed a lot, I would
> recommend to do (cd src; make tools gate) and copy these too.
>
> ♪♫ Alex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Feed reader and bookmarker

2018-04-11 Thread Henrik Sarvell
Hi Manuel,

I'll try and put it up in some way given the response.

Will notify in this thread when done.



On Tue, Apr 10, 2018 at 3:52 PM, Manuel Cano <manutalc...@gmail.com> wrote:

> Hi,
>
> Where can we find it?
>
> Kind regards,
> Manu
>
> 2018-04-08 15:22 GMT+02:00 Henrik Sarvell <hsarv...@gmail.com>:
>
>> Hi list,
>>
>> Before the AI stuff Alex was helping me with some DB related stuff that
>> was going into my new RSS and bookmarker combo of an app.
>>
>> The bookmarking part is a result of delicious deteriorating to such an
>> extent that it was unusable.
>>
>> The feed reading I already had more or less completed in an earlier
>> unpresentable app.
>>
>> It looks like I'm not going to manage to complete that last mile to get
>> to a polished thing. I'm still using it though so it must be good enough.
>>
>> It might take me an hour or two to write an install tutorial in case
>> there is interest in me uploading the project?
>>
>> It's a non-trivial example of a complete app using the standard PicoLisp
>> DB after all, that could be used by beginners to explore without having to
>> overload IRC and mailing list with questions.
>>
>> The database parts should be fairly solid (as they're made by Alex as
>> much as by me) with progressively less clean code upwards in the stack so
>> to speak, ie using jquery and more or less ad hoc Ajax requests.
>>
>
>


Re: Version 17.12 question / error

2018-04-11 Thread Henrik Sarvell
Thanks Alex, will try and find the time to refactor all the local calls in
the ext library sources.

Regarding ssl and httpGate, I'm managing proxy forwarding with Nginx these
days (encrypted too) so I could actually just delete them as I don't use
them anymore. I should probably create a small writeup on how to do that
for a typical PL project listening on a non standard port. Nginx has been a
real eyeopener on how heavy Apache is in comparison.

>I use '[' and ']' if there is more than one symbol instead of '(' and ')'
as a
>convention. See @lib/vip.l, @lib/android.l or @lib/gis.l for extensive
examples.

I see (local) [clearHistory clearCache] but I also see (local) loadTxt
loadUrl in android.l?


On Tue, Apr 10, 2018 at 7:25 AM, Alexander Burger 
wrote:

> Hi Henrik,
>
> > When I try to run my stuff I get [ext/base.l:9] pico -- Bad symbol
> namespace
> >
> > And that file currently looks like this:
> > https://bitbucket.org/hsarvell/ext/src/31474ae47656ae0c020f7009c9ed14
> c5cc86cc44/base.l?at=default=file-view-default
>
> It is the 'local' call:
>
>(local num?)
>
>
> The syntax of 'local' changed last year, it must be
>
>(local) num?
>
> of
>
>(local) [num?]
>
> I use '[' and ']' if there is more than one symbol instead of '(' and ')'
> as a
> convention. See @lib/vip.l, @lib/android.l or @lib/gis.l for extensive
> examples.
>
>
>
> > And just to make sure I didn't copy the wrong file or anything (I
> compiled
> > in a separate dir and copied on top in the /opt/picolisp/bin/ dir):
> > ...
> > -rwxrwxrwx  1 henrik henrik   5048 Oct  9  2008 balance
> > -rwxrwxrwx  1 henrik henrik  14824 Jul 10  2014 httpGate
> > -rwxrwxrwx  1 henrik henrik   5012 Oct  9  2008 lat1
> > -rwxrwxr-x  1 henrik henrik 204736 Apr  9 21:59 picolisp
>
> This should be fine, but as httpGate and ssl also changed a lot, I would
> recommend to do (cd src; make tools gate) and copy these too.
>
> ♪♫ Alex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Version 17.12 question / error

2018-04-09 Thread Henrik Sarvell
Hi,

I just downloaded and complied the 17.12 version in order to get detach
(was using a pre-detach version before).

When I try to run my stuff I get [ext/base.l:9] pico -- Bad symbol namespace

And that file currently looks like this:
https://bitbucket.org/hsarvell/ext/src/31474ae47656ae0c020f7009c9ed14c5cc86cc44/base.l?at=default=file-view-default

Also, I can not see any mention of a breaking change relating to this in
the CHANGES file.

And just to make sure I didn't copy the wrong file or anything (I compiled
in a separate dir and copied on top in the /opt/picolisp/bin/ dir):

Compile dir:
henrik@henrik-pc:/feting/Downloads/picoLisp/bin$ ls -la
total 236
drwxrwxr-x  2 henrik henrik   4096 Apr  9 21:59 .
drwxrwxr-x 19 henrik henrik   4096 Apr  9 21:36 ..
-rwxrwxr-x  1 henrik henrik 204736 Apr  9 21:59 picolisp


/opt/picolisp/bin/ dir:
henrik@henrik-pc:/opt/picolisp/bin$ ls -la
total 320
drwxrwxrwx  2 henrik henrik   4096 Apr  9 21:59 .
drwxrwxrwx 29 henrik henrik   4096 Apr  9 21:57 ..
-rwxrwxrwx  1 henrik henrik   5048 Oct  9  2008 balance
-rwxrwxrwx  1 henrik henrik  14824 Jul 10  2014 httpGate
-rwxrwxrwx  1 henrik henrik   5012 Oct  9  2008 lat1
-rwxrwxr-x  1 henrik henrik 204736 Apr  9 21:59 picolisp


Re: Math exp issue?

2018-02-21 Thread Henrik Sarvell
I've got this currently:

## See http://rosettacode.org/wiki/Matrix_transposition#PicoLisp
(de trM (M)
   (apply mapcar M list) )

## According to https://en.wikipedia.org/wiki/Matrix_multiplication
## Handles all scenarios just like Python's nympy's dot().
(de mM @
   (let (Am (next)
   Bm (next)
   Mrows '((Ar) (make
   (for Br (trM Bm)
  (link (sum */ Ar Br (1.0 .))) ) ) ) )
  (let Rm
 (if2 (exlst~flat? Am) (exlst~flat? Bm)
## Both are flat so we just multiply them and sum,
## the return will be a number, see
https://en.wikipedia.org/wiki/Dot_product
(sum * Am Bm)
## The A matrix is flat, the B matrix is not so we loop the
subs of the B and multiply with A.
(Mrows Am)
## B is flat, A is not, doesn't work.
(prog
   (println "Shape mismatch")
   (bye) )
## They are both multidimensional so we loop both.
(make
   (for Ar Am
  (link
 (Mrows Ar) ) ) ) )
 (ifn (rest)
Rm
(nM Rm (next)) ) ) ) )

I didn't see much benefit in using the Rosetta version for matrix
multiplication but nice touch there with the sum */ and (1.0 .), that was
definitely needed.

Will try and translate this one from python to PL now:
https://medium.com/technology-invention-and-more/how-to-build-a-multi-layered-neural-network-in-python-53ec3d1d326a




On Wed, Feb 21, 2018 at 7:55 PM, Henrik Sarvell <hsarv...@gmail.com> wrote:

> Thanks Alex,
>
> I'll try them out, and modify multiply to handle an arbitrary amount of
> matrices.
>
> On Wed, Feb 21, 2018 at 11:36 AM, Alexander Burger <a...@software-lab.de>
> wrote:
>
>> Hi Henrik,
>>
>> > For reference, the article / tutorial:
>> > https://medium.com/technology-invention-and-more/how-to-buil
>> d-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1
>>
>> Nice!
>>
>>
>> > (de colM (M Cn)
>> >(make
>> >   (for Col M
>> >  (link (car (nth Col Cn ) )
>> >
>> > ## Transpose matrix: https://en.wikipedia.org/wiki/Transpose
>> > (de trM (M)
>> >(make
>> >   (for N (length (car M))# Number of columns.
>> >  (link (colM M N)) ) ) )
>>
>> Note that there are some matrix manipulation tasks in RosettaCode.
>>
>> For example, the matrix transposition is simply:
>>
>>(de matTrans (Mat)
>>   (apply mapcar Mat list) )
>>
>>
>> Matrix multiplication (for 2 matrices) in RosettaCode is
>>
>>(de matMul (Mat1 Mat2)
>>   (mapcar
>>  '((Row)
>> (apply mapcar Mat2
>>'(@ (sum */ Row (rest) (1.0 .))) ) )
>>  Mat1 ) )
>>
>> Not sure if this fits your needs ...
>>
>> ♪♫ Alex
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>
>


Re: Math exp issue?

2018-02-21 Thread Henrik Sarvell
Thanks Alex,

I'll try them out, and modify multiply to handle an arbitrary amount of
matrices.

On Wed, Feb 21, 2018 at 11:36 AM, Alexander Burger 
wrote:

> Hi Henrik,
>
> > For reference, the article / tutorial:
> > https://medium.com/technology-invention-and-more/how-to-
> build-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1
>
> Nice!
>
>
> > (de colM (M Cn)
> >(make
> >   (for Col M
> >  (link (car (nth Col Cn ) )
> >
> > ## Transpose matrix: https://en.wikipedia.org/wiki/Transpose
> > (de trM (M)
> >(make
> >   (for N (length (car M))# Number of columns.
> >  (link (colM M N)) ) ) )
>
> Note that there are some matrix manipulation tasks in RosettaCode.
>
> For example, the matrix transposition is simply:
>
>(de matTrans (Mat)
>   (apply mapcar Mat list) )
>
>
> Matrix multiplication (for 2 matrices) in RosettaCode is
>
>(de matMul (Mat1 Mat2)
>   (mapcar
>  '((Row)
> (apply mapcar Mat2
>'(@ (sum */ Row (rest) (1.0 .))) ) )
>  Mat1 ) )
>
> Not sure if this fits your needs ...
>
> ♪♫ Alex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Math exp issue?

2018-02-20 Thread Henrik Sarvell
I think I did it.

For reference, the article / tutorial:
https://medium.com/technology-invention-and-more/how-to-build-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1

This is the PL solution and it relies on my ext lib here:
https://bitbucket.org/hsarvell/ext/overview
--
(load
   "lib.l"
   "ext.l"
   "ext/base.l"
   "ext/lst.l"
   "lib/math.l")

(import exlst~applyr)

(de colM (M Cn)
   (make
  (for Col M
 (link (car (nth Col Cn ) )

## Transpose matrix: https://en.wikipedia.org/wiki/Transpose
(de trM (M)
   (make
  (for N (length (car M))# Number of columns.
 (link (colM M N)) ) ) )

## Multiply matrix: https://en.wikipedia.org/wiki/Matrix_multiplication
(de mM @
   (let (Am (next) Bm (next))
  (let Rm
 (if2 (exlst~flat? Am) (exlst~flat? Bm)
(sum * Am Bm)
(make
   (for Br (trM Bm)
  (link (sum * Am Br)) ) )
(prog
   (println "Shape mismatch")
   (bye))
(make
   (for Ar Am
  (link
 (make
(for Br (trM Bm)
   (link (sum * Ar Br)) ) ) ) ) ) )
 (ifn (rest)
Rm
(nM Rm (next)) ) ) ) )

(de sigm (X)
   (*/ 1.0 1.0 (+ 1.0 (exp (- X )

(de sigmd (X)
   (*/ X (- 1.0 X) 1.0))

(setq *Inputs '((0 0 1) (1 1 1) (1 0 1) (0 1 1)))
(setq *Outputs (trM '((0 1.0 1.0 0
#(setq *Weights (make (do 3 (link (list (- (* 2 (excmd~randNum 0 1.0))
1.0))
(setq *Weights '((-0.16595599) (0.444064899) (-0.99977125)))

(do 1
   (let (output (applyr 'sigm (mM *Inputs *Weights))
   weightInc (applyr '((El1 El2) (*/ El1 El2 1.0)) (applyr '-
*Outputs output) (applyr 'sigmd output)) )
  (setq *Weights (applyr '+ *Weights (mM (trM *Inputs) weightInc))) ) )

(println (applyr 'sigm (mM '(1 0 0) *Weights)))

(bye)
--


And here is the Python solution:
--
from numpy import exp, array, random, dot

def sigm(x):
return 1 / (1 + exp(-x))

def sigmd(x):
return x * (1 - x)

training_set_inputs = array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]])
training_set_outputs = array([[0, 1, 1, 0]]).T
random.seed(1)
synaptic_weights = 2 * random.random((3, 1)) - 1

for iteration in xrange(1):
output = sigm(dot(training_set_inputs, synaptic_weights))
synaptic_weights += dot(training_set_inputs.T, (training_set_outputs -
output) * sigmd(output))

print sigm(dot(array([1, 0, 0]), synaptic_weights))
--

A lot is going on behind the scenes in the Python solution, sigm(matrix)
somehow gets translated to apply(sigm, matrix) behind the scenes, very
fancy.

Also m + m automatically understands that what to do because of opeator
overloading or some such.

So what do you think, is there a point in trying to take this AI / ML stuff
further in PL or should I / we just give up?

It feels like these type of things are just more suited for infix notation
as opposed to prefix notation or is that just literally decades of doing
math on paper with infix notation?

One thing though, the PL code is more explicit, it's easier for me to
understand what's going on whereas the Python stuff contains dizzying
amounts of magic.

Any thoughts?


Re: Math exp issue?

2018-02-13 Thread Henrik Sarvell
Ah, great resource, thanks, let's see if I can get all the way to the
finish line on this one now...

On Mon, Jan 29, 2018 at 8:25 AM, Alexander Burger 
wrote:

> On Mon, Jan 29, 2018 at 08:14:31AM +0100, Alexander Burger wrote:
> > To the question why it returns 101 for (exp 1): 101 is the
> > representation of the float number 1:
> >
> >: (round 101)
> >-> "1.000"
>
> .. and (exp 1) is (exp 0.01) ...
>
> https://the-m6.net/blog/fixed-point-arithmetic-in-picolisp.html
>
> ♪♫ Alex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Math exp issue?

2018-01-28 Thread Henrik Sarvell
Hi list, long time no see!

The definition of exp in math.l leads me to believe that we're calling this
C function:
https://www.tutorialspoint.com/c_standard_library/c_function_exp.htm

Since we can't do floating numbers in PL and I notice that math.l uses (scl
6) I would hope to get get something like 2718281 back from this call:
(println (exp 1)).

But that is not happening, instead I get 101.

Related is my current project which is converting this naive / simple
neural network written in Python to PL:
https://medium.com/technology-invention-and-more/how-to-build-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1

Where I'm currently stuck on the sigmoid function which in turn is making
use of exp.


Re: KangarooTwelve: fast hashing based on Keccak-p

2017-06-01 Thread Henrik Sarvell
The collection is now starting to feel pretty exhaustive :-)

On Thu, Jun 1, 2017 at 6:20 PM, Mike Pechkin  wrote:

> hi,
>
> Implementation:
> http://keccak.noekeon.org/KangarooTwelve.pdf
> https://bitbucket.org/mihailp/tankfeeder/src/
> 644e66f9f04d07227dc4c30cd0dfecd5212aa22b/crypto/?at=default
>
> files:
> kangaroo12.l
> test-kangaroo12.l
>
> (mike)
>
>


Re: Too many file descriptors

2017-05-30 Thread Henrik Sarvell
That went too fast, it can't work the way I suggested, below works and is
tested:

(dm rssToPages> @
   (let (Str (or (next) (exclient~call (; This rssLink) "" 5)) Fd (pipe
(prin Str)))
  (for A (rss~parseFrom Fd)
 (let Url
(req!> '+Url
   'link (a; A 'htmlUrl)
   'title (a; A 'title)
   'site This
   'pubAt (dtp~utcToStamp (a; A 'pubDate)) )
(linkUrl> '+SiteTag Url This) ) )
  (close Fd)) )




On Tue, May 30, 2017 at 10:20 PM, Henrik Sarvell <hsarv...@gmail.com> wrote:

> Thanks Alex,
>
> I've changed the look to your #1 suggestion now:
>
> (dm rssToPages> @
>(let Str (or (next) (exclient~call (; This rssLink) "" 5))
>   (for A (rss~parseFrom
> (pipe
>(prin Str)
>(let Url
>   (req!> '+Url
>  'link (a; A 'htmlUrl)
>  'title (a; A 'title)
>  'site This
>  'pubAt (dtp~utcToStamp (a; A 'pubDate)) )
>   (linkUrl> '+SiteTag Url This) ) ) ) ) ) )
>
> Should work right?
>
>
>
>
> On Tue, May 30, 2017 at 10:23 AM, Alexander Burger <a...@software-lab.de>
> wrote:
>
>> Hi Henrik,
>>
>> > I'm running into too many file descriptors (again), or rather a file
>> > descriptor leak.
>> > ...
>> >   (for A (rss~parseFrom (pipe (prin Str)))
>>
>> (pipe (prin Str))) is probably the culprit.
>>
>> 'pipe' has two forms of invocation:
>> 1. (pipe exe . prg) executes 'prg', and cleans up everything (wait for
>> child and
>>close the open file).
>> 2. (pipe exe) returns a file descriptor, to be used subsequently. So you
>> need to
>>remember it, and close it when done.
>>
>> ♪♫ Alex
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>
>


Re: Too many file descriptors

2017-05-30 Thread Henrik Sarvell
Thanks Alex,

I've changed the look to your #1 suggestion now:

(dm rssToPages> @
   (let Str (or (next) (exclient~call (; This rssLink) "" 5))
  (for A (rss~parseFrom
(pipe
   (prin Str)
   (let Url
  (req!> '+Url
 'link (a; A 'htmlUrl)
 'title (a; A 'title)
 'site This
 'pubAt (dtp~utcToStamp (a; A 'pubDate)) )
  (linkUrl> '+SiteTag Url This) ) ) ) ) ) )

Should work right?




On Tue, May 30, 2017 at 10:23 AM, Alexander Burger 
wrote:

> Hi Henrik,
>
> > I'm running into too many file descriptors (again), or rather a file
> > descriptor leak.
> > ...
> >   (for A (rss~parseFrom (pipe (prin Str)))
>
> (pipe (prin Str))) is probably the culprit.
>
> 'pipe' has two forms of invocation:
> 1. (pipe exe . prg) executes 'prg', and cleans up everything (wait for
> child and
>close the open file).
> 2. (pipe exe) returns a file descriptor, to be used subsequently. So you
> need to
>remember it, and close it when done.
>
> ♪♫ Alex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Too many file descriptors

2017-05-29 Thread Henrik Sarvell
Hi,

I know this has been discussed before but it looks like in IRC because I
can't find anything via Google.

I'm running into too many file descriptors (again), or rather a file
descriptor leak.

For completeness here is the whole flow:

1.) I loop a list of sites and access pre-downloaded RSS files like this:

(for S *Sites
   (let Str (in (pack *Downloads (; S id) ".xml") (till NIL T))
  (rssToPages> S Str)) )

2.) rssToPages> looks like this:

(dm rssToPages> @
   (let Str (or (next) (exclient~call (; This rssLink) "" 5))
  (for A (rss~parseFrom (pipe (prin Str)))
 (let Url
(req!> '+Url
   'link (a; A 'htmlUrl)
   'title (a; A 'title)
   'site This
   'pubAt (dtp~utcToStamp (a; A 'pubDate)) )
(linkUrl> '+SiteTag Url This) ) ) ) )

The exclient call will never happen in this case as we're passing in the
content in the argument.

rss~parseFrom is here:
https://bitbucket.org/hsarvell/ext/src/tip/rss.l?at=default=file-view-default

So as can be seen there's quite a lot of matching involved (in rss) which I
remember had something to do with open file descriptors, but also pipe and
in calls.

I don't know what is going wrong here because I feel like all open
descriptors should be closed on each conclusion of the site and/or article
loop. But they just seem to be accumulating for some reason.

/Henrik


Re: Order by database question

2017-05-01 Thread Henrik Sarvell
Hi Alex thanks,

I suspected that the fact that I was scanning two separate indexes
prevented proper ordering - from reading the select tutorial (very good
piece that one) - but I wanted to confirm.

Added Aux and just replaced the select with your db line and it works.




On Mon, May 1, 2017 at 9:58 AM, Alexander Burger 
wrote:

> Hi Henrik,
>
> > (class +UrlTag +Macropisobj)
> > (rel id(+Key +Number))
> > (rel url   (+Ref +Link) NIL (+Url))
> > (rel usr   (+Ref +Link) NIL (+User))
> > (rel tag   (+Aux +Ref +Link) (usr) NIL (+Tag))
> > ...
> > SELECT * FROM UrlTag WHERE usr = Usr ORDER BY id DESC LIMIT 0,50
> >
> > I manage everything apart from the ordering of the result correctly.
> >
> > I thought this select would order things in descending order:
> >
> > (select (@Obj)
> > ((id +UrlTag (T . NIL)) (usr +UrlTag @Usr))
> > (same @Usr @Obj usr) )
>
> No. If you 'select' by more than one index (here 'id' and 'usr'), the
> order of
> the results is not predictable, because both indexes are searched in
> parallel.
>
>
> We have two possibilities:
>
> 1. If there are not too many expected results, you can first 'select' or
>'collect' all of them, and sort them in memory, e.g.
>
>   (by '((This) (- (: id))) sort (collect 'usr '+UrlTag Usr))
>
> or
>
>   (flip (by '((This) (: id)) sort (collect 'usr '+UrlTag Usr)))
>
>(I usually use 'flip' instead of the negative key)
>
>
> 2. If you expect too many results, so that you don't want to load them all
> into
>memory at once, you need a dedicated index with the desired ordering.
> You
>have already an '+Aux' in your model, but then you need also 'id' for
> 'usr':
>
>   (rel usr (+Aux +Ref +Link) (id) NIL (+User))
>
>Here you can also 'collect' (if there are not many results) from the
>index of 'Usr'
>
>   (collect 'usr '+UrlTag Usr)
>
>to get increasing id's, or - for your case -
>
>   (collect 'usr '+UrlTag (list Usr T) (list Usr))
>
>for decreasing id's. Again, for many results, you 'select' or simply
> 'db'
>
>   (db usr +UrlTag ((@Usr T) @Usr) @Obj)
>
> Not tested, I hope there are not too many errors.
>
> ♪♫ Alex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Order by database question

2017-04-30 Thread Henrik Sarvell
Hi list,

I've been looking through the docs and all my notes but it looks like I'm
not managing to get the result I want no matter how I try.

I've got this E/R:

(class +UrlTag +Macropisobj)
(rel id(+Key +Number))
(rel url   (+Ref +Link) NIL (+Url))
(rel usr   (+Ref +Link) NIL (+User))
(rel tag   (+Aux +Ref +Link) (usr) NIL (+Tag))

Note that id is auto incrementing on every insert.

And I'm using goal, prove and select to try and achieve the Picolisp DB
version of this SQL:

SELECT * FROM UrlTag WHERE usr = Usr ORDER BY id DESC LIMIT 0,50

I manage everything apart from the ordering of the result correctly.

I thought this select would order things in descending order:

(select (@Obj)
((id +UrlTag (T . NIL)) (usr +UrlTag @Usr))
(same @Usr @Obj usr) )

But it seems I was wrong?


Re: Header parsing

2017-04-19 Thread Henrik Sarvell
Hi Rowan,

If it makes you feel better, I get all your emails because I've created a
Gmail filter that makes sure picolisp mail list mails always go through the
filters.






On Wed, Apr 19, 2017 at 11:57 AM, Rowan Thorpe 
wrote:

> BTW: I receive DMARC reports about bounced/quarantined mails spoofing
> my address, and just received one from fastmail which matches the
> quarantined deliveries vukini reported (they failed validation due to
> the accidentally forwarded SPF and DKIM headers, as I predicted).
>
> ..so it seems my posts to the list over the years have mostly reached
> an audience of one  :-D
>
> --
> Rowan Thorpe
> http://twitter.com/rowanthorpe
> "There is a great difference between worry and concern. A
> worried person sees a problem, and a concerned person solves a
> problem." - Harold Stephens
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Is there documentation for the libraries in @lib/ ?

2017-04-08 Thread Henrik Sarvell
http.l
Is the base logic for the out of the box app functionality, a lot of it has
to do with parsing and building http requests. With this file you can
launch your own http server. It's the basis (as in copy paste with some
modifications) for my own "web stack" as well:
https://bitbucket.org/hsarvell/pl-web

pilog.l
I don't know about direct documentation as in an explanation of every code
block in that file but this is probably helpful:
https://software-lab.de/doc/select.html



On Sun, Apr 2, 2017 at 7:16 AM, Joh-Tob Schäg  wrote:

> Yes you can not find any documentation.
>
> 2017-04-02 3:36 GMT+02:00 Bruno Franco :
>
>> I can find the documentation for the default functions, and for the form
>> functions, but how about libraries like pilog.l or http.l?
>>
>
>


Re: Future of PicoLisp?

2017-02-08 Thread Henrik Sarvell
How convenient then that compiling PL is trivial, it's probably the easiest
and most hassle free thing I've ever had to compile from source.

On Fri, Feb 3, 2017 at 8:47 AM, Alexander Burger 
wrote:

> Hi all,
>
> the future of PicoLisp is dark. I'm not sure if it can survive in packaged
> distribution.
>
> Ubuntu doesn't support it any more, probably due to the PIE (position
> independent executable) on x86-64.
>
> And at least on Android they seem to demand switching to Clang. The 32-bit
> versions of PicoLisp (pil32 and mini) which are written in C cannot be
> compiled
> on Clang, because Clang doesn't support dynamically allocated arrays, which
> pil32 depends on. As far as I notices, pil64 also has trouble on
> Clang/Android.
>
> :( Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Date query question

2016-12-27 Thread Henrik Sarvell
Yes, like I thought, so I doubt that it will be an improvement over the
current state which looks like this:

## We want all projects that are NOT outside of the range, ie:
## 1.) End date is lower than the start date of the range.
## 2.) Start date is higher than the end date of the range.
## Therefore we generate all projects whose:
## 1.) Start date is smaller than the end date of the range.
## 2.) End date is larger than the start date of the range.
(dm getCurrent> (Sdate Edate)
   (solve
  (quote
 @Rng1 (cons NIL Edate)# The first range
 @Rng2 (cons Sdate T)  # The second range
 (select (@Proj)
((sDate +Proj @Rng1) (eDate +Proj @Rng2)) # Search two indexes
in parallel
(range @Rng1 @Proj sDate)  # Check ranges
(range @Rng2 @Proj eDate) ) )
  @Proj ) )

The above works, tested 100%, it looks like it's going to scan the whole
database though in the generate clauses, which means collect on id with
subsequent list filter is probably just as fast, or perhaps not?




On Tue, Dec 27, 2016 at 8:27 AM, Alexander Burger <a...@software-lab.de>
wrote:

> On Mon, Dec 26, 2016 at 11:19:02PM +0100, Henrik Sarvell wrote:
> > If I do the relations with the +UB index and put 2016-10-01 as the start
> > date and 2016-10-20 as the end date for a specific project, do I get that
> > project in my result set if I do the collect with sdate 2016-10-15 and
> end
> > date 2016-11-15?
>
> > > >(rel sDate (+UB +Aux +Ref +Date) (eDate))
> > > >(rel eDate (+Date))
> > > >
> > > > Then a 'collect' would find the range directly:
> > > >
> > > >(collect 'sDate '+Proj (list Sdate Sdate) (list Edate Edate))
>
> No. Consider eDate and sDate as coordinates in a 2-dimensional space,
> where a
> project is a point in that space.
>
> So you need to collect all projects with sDate at least in the range
> (2016-10-01 . 2016-10-01) and eDate at least in the range
> (2016-10-20 . 2016-10-20) to include the above project.
>
> A collection with the ranges (2016-10-1 . 2016-10-31) and (2016-11-1 .
> 2016-11-30), for example, would return all projects which started in
> October AND
> ended in November 2016.
>
> The ranges are inclusive btw.
>
> - Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Date query question

2016-12-26 Thread Henrik Sarvell
If I do the relations with the +UB index and put 2016-10-01 as the start
date and 2016-10-20 as the end date for a specific project, do I get that
project in my result set if I do the collect with sdate 2016-10-15 and end
date 2016-11-15?


On Mon, Dec 12, 2016 at 1:01 PM, Alexander Burger <a...@software-lab.de>
wrote:

> On Mon, Dec 12, 2016 at 11:12:22AM +0100, Henrik Sarvell wrote:
> > This looks like the one I need, I want all projects whose date range
> > has any kind of overlap with the given date range.
>
> How do you think about the '+UB' tree solution I suggested in my follow-up
> mail?
>
> >(class +Proj +Macropisobj)
> >...
> >(rel sDate (+UB +Aux +Ref +Date) (eDate))
> >(rel eDate (+Date))
> >
> > Then a 'collect' would find the range directly:
> >
> >(collect 'sDate '+Proj (list Sdate Sdate) (list Edate Edate))
>
> I think that is much more elegant and efficient.
>
> - Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Date query question

2016-12-12 Thread Henrik Sarvell
This looks like the one I need, I want all projects whose date range
has any kind of overlap with the given date range.

Thanks, will try it!

On Thu, Nov 17, 2016 at 4:10 PM, Alexander Burger  wrote:
> Hi Henrik,
>
>> (class +Proj +Macropisobj)
>> (rel id (+Key +Number))
>> (rel nm (+Ref +String))
>> (rel sDate (+Ref +String))
>> (rel eDate (+Ref +String))
>>
>> (dm getCurrent> (Sdate Edate)
>>(filter '((P) (or
>> (< Sdate (; P sDate) Edate)
>> (< Sdate (; P eDate) Edate)
>> (< Sdate (; P sDate) (; P eDate) Edate) ) )
>>   (collect 'id This) ) )
>> ...
>> But how would the above problem be solved with Pilog and select if we have
>> more than "a couple of hundred objects" in the database?
>
> If you know that the *result* will be within a few hundred hits (not the
> total DB size), and the difference between start and end is less than
> e.g. 100 days, then you could first restrict the collection a bit
>
>(collect 'sDate '+Proj Sdate (+ Edate 100))
>
> (works of course only for +Date types), and then filter that further.
> This is surely the most efficient way for a small set of results.
>
>
> The same you can do in Pilog with the 'db' predicate for an larger
> result set, and if you want to avoid a 'select'
>
>(? @Rng (cons Sdate (+ Edate 100))
>   (db sDate +Proj @Rng @Proj) )
>
>
> But 'select' is the most general - and on big data sets perhaps the most
> efficient - way. You could try
>
>(?
>   @Sdate (cons Sdate T)  # Range with open end
>   @Edate (cons Edate NIL)# Reversed range with open start
>   (select (@Proj)
>  ((sDate +Proj @Sdate) (eDate +Proj @Edate))  # Search two indexes in 
> parallel
>  (range @Sdate @Proj sDate)   # Check ranges
>  (range @Edate @Proj eDate) ) )   # Check ranges
>
> I haven't tested this ;)
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Date query question

2016-11-17 Thread Henrik Sarvell
Hi Rafik,

Nice stuff, but I don't need that magic, the goal here is simply adding
humans to projects and displaying the schedule to see who might be
available to do new stuff at some point in time.





On Thu, Nov 17, 2016 at 12:15 PM, Rafik NACCACHE <rafik.nacca...@gmail.com>
wrote:

> HEy Henrik,
>
> Not related by U wrote a project scheduling library and a tasks parser for
> natural language in Clojure,
>
> You might want to take a look on it here:
>
> https://github.com/turbopape/milestones
>
> There is one online dome here:
> http://turbopape.github.io/milestones/
>
> I'll be happy if you can review it (and why not, leave a star on it :) )
>
> If you want any explanationa on the scheduling algorihtm, I'll be more
> than happy to discuss it with you !
>
> Cheers,
>
> Rafik
>
> 2016-11-17 12:05 GMT+01:00 Henrik Sarvell <hsarv...@gmail.com>:
>
>> Hi list,
>>
>> I'm trying to build a project scheduler / planner.
>>
>> This is the E/R for a project:
>>
>> (class +Proj +Macropisobj)
>> (rel id (+Key +Number))
>> (rel nm (+Ref +String))
>> (rel sDate (+Ref +String))
>> (rel eDate (+Ref +String))
>>
>> (dm getCurrent> (Sdate Edate)
>>(filter '((P) (or
>> (< Sdate (; P sDate) Edate)
>> (< Sdate (; P eDate) Edate)
>> (< Sdate (; P sDate) (; P eDate) Edate) ) )
>>   (collect 'id This) ) )
>>
>> I haven't decided on whether or not to use +Date yet so the above dates
>> are on the "Y-m-d" format currently.
>>
>> I need to find all projects which are active during a certain time
>> period, for instance between 2016-11-01 and 2016-12-31.
>>
>> Logically that means finding all projects which have either a start date
>> or an end date in the period OR all projects with a start date before the
>> range that also have an end date after the range.
>>
>> I can fairly trivially do a collect and then a filter on the results of
>> the collect as shown above.
>>
>> But how would the above problem be solved with Pilog and select if we
>> have more than "a couple of hundred objects" in the database?
>>
>>
>>
>
>
> --
>
>
> [image: --]
>
> Rafik Naccache
> [image: https://]about.me/rafik_naccache
>
> <https://about.me/rafik_naccache?promo=email_sig_source=email_sig_medium=email_sig_campaign=external_links>
>


Date query question

2016-11-17 Thread Henrik Sarvell
Hi list,

I'm trying to build a project scheduler / planner.

This is the E/R for a project:

(class +Proj +Macropisobj)
(rel id (+Key +Number))
(rel nm (+Ref +String))
(rel sDate (+Ref +String))
(rel eDate (+Ref +String))

(dm getCurrent> (Sdate Edate)
   (filter '((P) (or
(< Sdate (; P sDate) Edate)
(< Sdate (; P eDate) Edate)
(< Sdate (; P sDate) (; P eDate) Edate) ) )
  (collect 'id This) ) )

I haven't decided on whether or not to use +Date yet so the above dates are
on the "Y-m-d" format currently.

I need to find all projects which are active during a certain time period,
for instance between 2016-11-01 and 2016-12-31.

Logically that means finding all projects which have either a start date or
an end date in the period OR all projects with a start date before the
range that also have an end date after the range.

I can fairly trivially do a collect and then a filter on the results of the
collect as shown above.

But how would the above problem be solved with Pilog and select if we have
more than "a couple of hundred objects" in the database?


Re: The behaviour of arg

2016-11-12 Thread Henrik Sarvell
In this case I simply use (arg 1), I just wanted to check if perhaps
(arg) defaulted to (arg 1) if no prior next had been called.

On Sat, Nov 12, 2016 at 7:45 AM, Alexander Burger  wrote:
> Hi Henrik, Andreas,
>
>> I guess this is the unforgiving punishment for calling (arg) without
>> calling (next) previously, consider the reference:
>> "If cnt is not given, the value that was returned from the last call
>> to next" -> no previous call to next -> invalid usage -> punishment
>
> Exactly! In fact, 'arg' should check such illegal usage. It is a
> secondary function, and not much used.
>
>
> The main workhorse for variable arguments is 'next', and often
> all that is needed:
>
>: (de f @
>   (while (next)
>  (println @) ) )
>
>-> f
>:  (f 1 2 3)
>1
>2
>3
>
> The purpose of 'arg' is to avoid the overhead of a local variable if
> the value is used more than once.
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


The behaviour of arg

2016-11-11 Thread Henrik Sarvell
Hi Alex and list.

If I do like this:

(de atst @
   (println (arg)) )
(atst 1 2 3)
(bye)

I never reach (bye) and I can't even abort with ctrl-c or d (had to
kill -9), is there a reason for this unforgiving punishment of arg
abuse or did I find some minor bug?
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Date library

2016-11-11 Thread Henrik Sarvell
Hi everyone, I'm announcing the newest addition to the Ext library, a
date class, I couldn't find anything like it already.

It's not fully tested but I'm putting it out anyway to prevent someone
from wasting 4-5 hours of their life by writing duplicate code:
https://bitbucket.org/hsarvell/ext/src/b11c78ae998597e7964f3fa88f638c43d2a9584f/dt.l?at=default=file-view-default
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: password hashes

2016-11-11 Thread Henrik Sarvell
Great, will try to use this in Macropis instead of shell commands.

On Mon, Nov 7, 2016 at 4:07 PM, Mike Pechkin  wrote:
> hi,
>
> 1. Now I have a full collection of password hashes:
> bcrypt
> pbkdf2
> scrypt
> 2. yescrypt and Argon2 are candidates in the future.
> Every hash works slower and slower already.
> 3. I've implement local password hasher pilpwd as (pbkdf2+sha256)
> 4 Ideas for future online minimalism version: https+native+Argon2 as mimic
> of
> https://getvau.lt/
> https://www.pwdhash.com/
> https://lesspass.com/#/
>
> All code are here:
> https://bitbucket.org/mihailp/tankfeeder/src/aea7dd71f485f5b6631f1d00afa04ce9f0b35948/crypto/?at=default
>
> Mike
>
>
>
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Simple Routing for web apps

2016-11-11 Thread Henrik Sarvell
Hi Joe, you might want to take a look at Jose's stuff:
https://bitbucket.org/iromero91/web.l/src/718174234c82c0d5931754d6c172ef6799eed54d?at=default

I'm the author of pl-web ( https://bitbucket.org/hsarvell/pl-web ),
it's a bit different than the pure blabla -> blabla mapping, it
doesn't provide that out of the box, just a few globals that you can
use to create something like Macropis for instance:
https://bitbucket.org/hsarvell/macropis

I just noted that the websocket docs on the pl-web page is very
outdated, will try to update it when time permits.



On Fri, Nov 11, 2016 at 6:31 PM, Alexander Burger  wrote:
> On Fri, Nov 11, 2016 at 10:50:00AM -0500, Joe Golden wrote:
>> " http[s]://server.org/12345/path/file
>>
>>   is forwarded to a server on localhost listening on port 12345, to ask for 
>> the resource "path/file". "
>>
>> How is this resource generated from the "path/file" request. Is
>> "path/file" a real pathname and file? I come from Drupal and PHP and the
>> URLs are all "virtual" or simply patterns and don't refer to a real
>> filesystem
>
> That's a valid question. In case of PicoLisp, all such pathnames in URLs
> are relative to the current working directory of the server process.
> This is normally the PWD the server was started in (in case of httpGate
> the 4th config parameter). No magic involved :)
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: MySQL native C wrapper

2016-11-06 Thread Henrik Sarvell
I just made things work with mariadb 10, the steps:

1.) apt-get install libmariadb-client-lgpl-dev
2.) Compile as per the instructions in mysql.c

Warning: next time I push the new mariadb based .so will go up, perhaps not
the best idea to keep it under version control...




On Sat, May 2, 2015 at 2:38 AM, Alexander Williams <a...@unscramble.co.jp>
wrote:

> OK I see. I'll have a look later today and see if I can handle those
> issues.
>
> Thanks!!
>
> On 2015-05-02, at 1:33 AM, Henrik Sarvell <hsarv...@gmail.com> wrote:
>
> I've now updated, due to time constraints I have not done the following:
>
> 1.) Linked straight to the mysql client library as I still need to call my
> conn function in mysql.c, in order to get rid of it one first needs to call
> mysql_init to get the connection struct, so far so good but then calling
> mysql_real_connect and being able to get the updated pointer properly
> requires somehow mapping the struct on line 242 in
> /usr/include/mysql/mysql.h in the call, too much; didn't do that.
>
> 2.) Some kind of proper query builder, there are some helper functions in
> the form of the mk*>s.
>
> Due to time constraints I believe I'm done for now for the foreseeable
> future.
>
>
>
>
> On Mon, Apr 27, 2015 at 10:14 AM, Henrik Sarvell <hsarv...@gmail.com>
> wrote:
>
>> Yes, you're right, I'll remove it and "link" straight to the lib, it
>> was something I did in the beginning of the process when I was unsure
>> of how transparently I could pass references to structs around.
>>
>> As it turned out it's completely seamless so your suggestion makes
>> perfect sense, or be my guest and do it yourself if you're anxious, I
>> won't have time until next weekend, feel free to copy whatever you
>> like from me.
>>
>> On Mon, Apr 27, 2015 at 3:28 AM, Alexander Williams
>> <a...@unscramble.co.jp> wrote:
>> > Henrik this is great!!
>> >
>> > I've been looking for something like this but it was a little lower on
>> my priority list. Thank you!
>> >
>> > I find it interesting that you wrote some C to initiate the mysql
>> connection Would it be easier to do it in PicoLisp and simply use
>> libmysqlclient.so ?
>> >
>> > On 2015-04-27, at 6:00 AM, Henrik Sarvell <hsarv...@gmail.com> wrote:
>> >
>> >> Hi list, I'm announcing this at a very early stage, earlier than I
>> >> would like to, in case someone else is also thinking about doing a
>> >> MySQL wrapper, to avoid duplicate work.
>> >>
>> >> I'm not doing this because I think that MySQL is in any way a better
>> >> alternative than the native DB functionality, rather the opposite.
>> >>
>> >> The main reasoning is that it might help adoption of the language as
>> >> I've come to believe that how the data is stored could be as big a
>> >> hurdle to switch as the language switch itself - for many
>> >> organisations - if they can keep their data as it is (to begin with)
>> >> half the battle might already be won.
>> >>
>> >> PicoLisp with MySQL is still better than say PHP with MySQL.
>> >>
>> >> It also helps in migrating from MySQL to the native DB.
>> >>
>> >> It's all inspired by Alex Williams' nice and instructive use of the
>> >> native stuff here: http://aw.github.io/picolisp//2015/02/22/nanomsg/
>> >>
>> >> And I couldn't have managed without AB's writeup here:
>> >> http://software-lab.de/doc/native.html
>> >>
>> >> Without further ado:
>> >> https://bitbucket.org/hsarvell/ext/src/default/mysql.l?at=default
>> >>
>> >> Note that you can't just run with the file linked to above, you need
>> >> the mysql.so file in the ext/so folder too.
>> >>
>> >> If no one beats me to it I will do some more work on this one in the
>> >> future and will announce here when there's something to show.
>> >> --
>> >> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>> > --
>> > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>>
>
>


Re: Ubuntu does not update PicoLisp

2016-09-03 Thread Henrik Sarvell
Weird, PL has always been that rare thing for me that just builds
flawlessly without any whining about missing dependencies, in like 5
seconds, on Ubuntu.

On Sat, Sep 3, 2016 at 4:04 PM, Alexander Burger 
wrote:

> Hi all,
>
> Ubuntu stopped to update PicoLisp in its distribution. I noticed that
> the next Ubuntu release (yakkety) still has only PicoLisp 15.11 !!
>
> This is rather bad. That version will be about one year old when yakkety
> comes out, with several flaws and bugs which were fixed meanwhile.
>
>
> I filed a bug report
>
>https://bugs.launchpad.net/bugs/1606142
>
> but during more than one month nothing happened.
>
> The claim is that they cannot build the PicoLisp executable. But 15.11
> uses exactly the same build process, and Kan-Ru Chen builds it that way
> perfectly for Debian.
>
>
> This means that the next Ubuntu release in October - and in consequence
> depending distributions like Mint - will come with that buggy version :(
>
> How can we get the Ubuntu people to take action? Any ideas?
>
> Best,
> - Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: PicoLisp Docker container

2016-06-08 Thread Henrik Sarvell
My experience with LXC is that they work just like a typical VM but
being a container they're faster and easier to handle. We've split up
our database over 10 LXC containers running MySQL, works great.

Caveat, we're using Ubuntu, I've gotten the impression that LXC is a
bit harder to setup in other distros.

My impression of Docker is that they've somehow reduced the
capabilities so that a docker container is not the equivalent of a
complete VM?

It's mostly because of this post:
https://www.flockport.com/lxc-vs-docker/ which is two years old soon
so things could've changed.



On Sat, Jun 4, 2016 at 5:43 AM, David Bloom <ipro...@gmail.com> wrote:
> I've got Triton elastic container infrastructure in mind in particular.  All
> of the security of Solaris zones plus tiny PicoLisp containers distributed
> over multiple servers with distributed storage = a very intriguing platform.
>
> I'm curious to hear about your experiences with LXC Henrik and thank you for
> the amazing tutorials by the way.  I've learned a great deal of PicoLisp
> from you, Alex, and the other contributors as well.
>
> Mike, I'll work on adding it to the glot list as well.
>
> Please note that now the image is available at:
> https://hub.docker.com/r/progit/docker-tinycore-picolisp/
>
> The name changed due to the way automated builds work with Docker Hub linked
> to a Github account.  Trimmed from 170MB down to 14MB!!!  This was done by
> copying a pre-compiled ./picoLisp/ into the image.  That should help with
> scaling.  Enjoy.
>
> On Tue, May 31, 2016 at 7:09 AM, Henrik Sarvell <hsarv...@gmail.com> wrote:
>>
>> I've got quite a lot of experience with LXC, can recommend highly if
>> Docker doesn't cut it.
>>
>>
>>
>> On Sun, May 29, 2016 at 7:52 PM, David Bloom <ipro...@gmail.com> wrote:
>>>
>>> Hello List,
>>>
>>> I'm trying to make a PicoLisp container for development and scaling of
>>> PicoLisp applications.  At first I tried compiling within an Alpine Linux
>>> container and got musl errors, then tried in a 64-bit Tinycore linux
>>> container.
>>>
>>> Using latest source 16.2 I get the error below, any thoughts?  I'm not a
>>> C guy so this doesn't make much sense to me even when I look at the source
>>> code.  Thank you in advance for any suggestions, for the amazing language,
>>> and a very supportive community.
>>>
>>> ~/picoLisp/src $ gcc --version
>>> gcc (GCC) 5.2.0
>>> Copyright (C) 2015 Free Software Foundation, Inc.
>>> This is free software; see the source for copying conditions.  There is
>>> NO
>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>> PURPOSE.
>>>
>>> ~/picoLisp/src $ make --version
>>> GNU Make 4.1
>>> Built for x86_64-unknown-linux-gnu
>>> Copyright (C) 1988-2014 Free Software Foundation, Inc.
>>> License GPLv3+: GNU GPL version 3 or later
>>> <http://gnu.org/licenses/gpl.html>
>>> This is free software: you are free to change and redistribute it.
>>> There is NO WARRANTY, to the extent permitted by law.
>>>
>>> ---
>>> ~/picoLisp/src $ make
>>> gcc -c -O2 -pipe -falign-functions=32 -fomit-frame-pointer
>>> -fno-strict-aliasing -W -Wimplicit -Wreturn-type -Wunused -Wformat
>>> -Wuninitialized -Wstrict-prototypes -D_GNU_SOURCE  -D_FILE_OFFS
>>> ET_BITS=64 -m32 -D_OS='"Linux"' main.c
>>> In file included from /usr/include/features.h:389:0,
>>> from /usr/include/stdio.h:27,
>>> from pico.h:5,
>>> from main.c:5:
>>> /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file
>>> or directory
>>> compilation terminated.
>>> Makefile:129: recipe for target 'main.o' failed
>>> make: *** [main.o] Error 1
>>>
>>> ---
>>> ~ $ cd picoLisp/src64/
>>> ~/picoLisp/src64 $ make
>>> ./mkAsm x86-64 ".linux" .s Linux base "" ../lib/map  version.l glob.l
>>> main.l gc.l apply.l flow.l sym.l subr.l big.l io.l db.l net.l err.l
>>> sys/x86-64.linux.code.l
>>> ../ersatz/pil: exec: line 5: java: not found
>>> Makefile:142: recipe for target 'x86-64.linux.base.s' failed
>>> make: *** [x86-64.linux.base.s] Error 2
>>>
>>
>
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Best way to learn picolisp

2016-06-08 Thread Henrik Sarvell
I would say PL is much easier, less cruft.

Start with picolisp.com

On Wed, Jun 8, 2016 at 2:08 PM, Lawrence Bottorff  wrote:
> So, what would the best way to learn picolisp be for a total beginner? It
> might seem like you should just bite the bullet and learn regular Common
> Lisp first, then start learning picolisp. That is, you should know all the
> capabilities of Lisp before you try to learn a derivative Lisp. Is this
> true?
>
> LB
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: PicoLisp Docker container

2016-05-31 Thread Henrik Sarvell
I've got quite a lot of experience with LXC, can recommend highly if Docker
doesn't cut it.



On Sun, May 29, 2016 at 7:52 PM, David Bloom  wrote:

> Hello List,
>
> I'm trying to make a PicoLisp container for development and scaling of
> PicoLisp applications.  At first I tried compiling within an Alpine Linux
> container and got musl errors, then tried in a 64-bit Tinycore linux
> container.
>
> Using latest source 16.2 I get the error below, any thoughts?  I'm not a C
> guy so this doesn't make much sense to me even when I look at the source
> code.  Thank you in advance for any suggestions, for the amazing language,
> and a very supportive community.
>
> ~/picoLisp/src $ gcc --version
> gcc (GCC) 5.2.0
> Copyright (C) 2015 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
>
> ~/picoLisp/src $ make --version
> GNU Make 4.1
> Built for x86_64-unknown-linux-gnu
> Copyright (C) 1988-2014 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <
> http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
>
> ---
> ~/picoLisp/src $ make
> gcc -c -O2 -pipe -falign-functions=32 -fomit-frame-pointer
> -fno-strict-aliasing -W -Wimplicit -Wreturn-type -Wunused -Wformat
> -Wuninitialized -Wstrict-prototypes -D_GNU_SOURCE  -D_FILE_OFFS
> ET_BITS=64 -m32 -D_OS='"Linux"' main.c
> In file included from /usr/include/features.h:389:0,
> from /usr/include/stdio.h:27,
> from pico.h:5,
> from main.c:5:
> /usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file
> or directory
> compilation terminated.
> Makefile:129: recipe for target 'main.o' failed
> make: *** [main.o] Error 1
>
> ---
> ~ $ cd picoLisp/src64/
> ~/picoLisp/src64 $ make
> ./mkAsm x86-64 ".linux" .s Linux base "" ../lib/map  version.l glob.l
> main.l gc.l apply.l flow.l sym.l subr.l big.l io.l db.l net.l err.l
> sys/x86-64.linux.code.l
> ../ersatz/pil: exec: line 5: java: not found
> Makefile:142: recipe for target 'x86-64.linux.base.s' failed
> make: *** [x86-64.linux.base.s] Error 2
>
>


Function browser in Emacs

2016-04-09 Thread Henrik Sarvell
This is a bit off topic but my new function browser does support
Picolisp out of the box :)

It might come in handy for all Picolispers on Emacs.

https://bitbucket.org/hsarvell/list-functions

http://www.prodevtips.com/2016/04/09/a-function-browser-for-emacs/
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Redesigned Wiki is Live

2016-03-30 Thread Henrik Sarvell
Well done Erik!

On Thu, Mar 24, 2016 at 4:34 PM, Erik Gustafson 
wrote:

> Hi List,
>
> I'm very excited to announce that the redesigned PicoLisp
> wiki is now running on the server! Have a look:
>
>http://picolisp.com
>
> In my (slightly biased) opinion, PicoLisp has one of the
> coolest programming language websites out there now. It's
> sleek and modern and should be very accessible from any
> device. Changes to the code base were minimal (mostly
> CSS), so it still works great with text-based browsers
> as well.
>
> But don't let the new paint job fool you. The wiki has
> much more to offer! I spent a lot of time going through
> the mail archives, finding the most helpful threads and
> turning them into new articles. I've tried to organize
> the documentation to be most helpful to newcomers, to
> set them on a clear path from beginner to lisp wizard.
>
> I'd love any feedback. How's the design feel? The copy?
> I tried my best to incorporate all the feedback I got
> from the initial homepage mockup I posted a few months
> ago.
>
> Note that there are still some rough spots in some of
> the articles/pages. I plan to fill that out in the
> coming weeks and continue to refine the content,
> hopefully with your help! As such, please hold off on
> posting to Reddit, HN, etc. for a bit. And if there is
> anything that seems to be missing, or you'd like to find
> a spot for something you've been working, let me know.
>
> So thanks to all of you for the great discussion over
> the years! It's been a lot fun and I've learned a ton.
> Finally, many thanks to Alex, not only for helping me
> better understand the wiki and put it back together,
> but for PicoLisp in general.
>
> Cheers y'all,
> Erik
>


Re: '+Agent' class

2016-03-29 Thread Henrik Sarvell
Hi Erik, the +Agent class in question makes use of rd and pr in combination
with asynchronously connecting to multiple external services, like this:

(dm eval> (A . @)
   (let? Sock (sock> This A)
  (when Sock
 (out Sock (pr (rest)))
 (prog1
(in Sock (rd))
(close> This Sock)

(dm evalAll> @
   (let Result
  (make
 (for N (getSockNums> This)
(later (chain (cons "void"))
   (eval> This N (rest)
  (wait 5000 (not (memq "void" Result)))
  Result))






On Tue, Mar 29, 2016 at 6:08 AM, Erik Gustafson 
wrote:

> Hi list,
>
> While reading through the mail archive, I found some interesting
> threads regarding distributed DB's (mostly conversations between
> Henrik and Alex, IIRC). An '+Agent' class was mentioned that
> abstracted away the manual setup details (e.g. direct
> manipulation of '*Ext', as in the 'remote/2' and '*Ext'
> documentation), though I wasn't able to find any code. I might
> have missed it, the threads were lengthy.
>
> I'm wondering, does anyone have the code for such a class? Or
> maybe a template as to how to go about designing one? I'm
> guessing the specifics are very dependent on the application
> structure.
>
> I'd like to venture beyond the remote/*Ext examples and learn
> more about distributed PL. It seems very powerful - yet largely
> unexplored, except by a couple people.
>
>
> Thanks,
> Erik
>


Re: Websockets now considered stable

2016-01-16 Thread Henrik Sarvell
Hi Joe, thanks for the pointer, had totally forgotten about that demo app.

I've removed the call from the demo, the wsServer logic has been
removed completely since it's now Redis that is responsible for
routing messages through the pub / sub handling.

I've also updated the readme with the fact that Redis is now a
required dependency.


On Thu, Jan 14, 2016 at 6:17 PM, Joe Bogner <joebog...@gmail.com> wrote:
> Hi Henrik,
>
> Thanks for sharing. I get the following when running the ws-demo:
>
>  ./pil pl-web/ws-demo/main.l -go
> ...
> !? (wsServer)
> wsServer -- Undefined
>
> I can't find the definition of wsServer anywhere. Is it missing from the
> repo?
>
> Thanks,
> Joe
>
> On Mon, Jan 4, 2016 at 4:27 PM, Henrik Sarvell <hsarv...@gmail.com> wrote:
>>
>> Update:
>>
>> The socketserver is now completely reliant on Redis, using Redis' pub
>> / sub functionality: http://redis.io/topics/pubsub
>>
>> The reason for this is that I was using the websocket server to handle
>> all websockets functionality for the site I'm being paid to work on
>> and it started running into problems as the site grew, the first issue
>> was an easy fix after Alex pointed me to it, increasing the amount of
>> file descriptors in src64/sys/x86-64.linux.defs.l, my line #115 now
>> looks like this: (equ FD_SET 1024)  # 1024 bit
>>
>> After re-compiling I could easily handle more than 500 clients and all
>> was well for a while.
>>
>> Unfortunately the site is growing so fast that just some month(s)
>> later the parent / root process started intermittently running at 100%
>> CPU utilization and the service stopped working for perhaps 10-20
>> minutes before resolving on its own. At this point peak usage involved
>> 2000 clients being connected at the same time.
>>
>> Alex suspects that the issue has got to do with how the internal logic
>> handles new processes being created when there are already a lot of
>> them present. In a normal HTTP server scenario this probably never
>> happens, imagine that every request takes on average 1 second to
>> perform before the socket closes, you would then need about 2000
>> requests per second in order to trigger the CPU problem, you'll run
>> into many other issues long before that happens in a non-trivial
>> scenario (trust me I've tested).
>>
>> In the end we switched over to a node.js based solution that also
>> relies on Redis' pub / sub functionality (that's where I got the idea
>> from to make the PL based solution also use it).
>>
>> I have tried to replicate the real world situation load wise and
>> number of clients wise but not been able to trigger the CPU issue
>> (this also seems to imply that Alex's suspicion is not completely on
>> target), it's impossible for me to replicate the real world situation
>> since I can't commandeer hundreds of machines all over the world to
>> connect to my test server. What I did manage to trigger though was
>> fairly high CPU usage in the child processes though, a situation that
>> also involved loss of service. After the switch to using pub / sub I
>> haven't been able to trigger it, so that's a win at least.
>>
>> Now for the real improvement, actually making HTTP requests to publish
>> something becomes redundant when publishing from server to client
>> since it's just a matter of issuing a publish call directly to Redis
>> instead. That lowers the amount of process creation by more than 90%
>> in my use case.
>>
>> Even though I can't be 100% sure as it currently stands I believe that
>> if I had implemented the websocket server using Redis' pub / sub to
>> begin with the CPU issue would probably never have happened and there
>> would've been no need to switch over to node.js.
>>
>> That being said, this type of service / application is better suited
>> for threads since the cost in RAM etc is lower.
>>
>> Final note, my decision to use one socket per feature was poor, it
>> allowed me a simpler architecture but had I opted for one socket with
>> "routing" logic implemented in the browser instead I could have
>> lowered the amount of simultaneous sockets up to 8 times. Peak usage
>> would then have been 2000 / 8 = 250 processes. Not only that, it turns
>> out that IE (yes, even version 11 / edge) only allows 6 simultaneous
>> sockets (including in iframes) per page. We've therefore been forced
>> to turn off for instance the tournament functionality for IE users.
>>
>>
>>
>> On Fri, Jun 26, 2015 at 9:30 PM, Henrik Sarvell <hsarv...@gmail.com>
&g

Re: picolisp and erlang in distributed/concurrent processing

2016-01-06 Thread Henrik Sarvell
Hi Lawrence, note that if you don't change the FD_SET as per my
description here:
http://www.mail-archive.com/picolisp@software-lab.de/msg05890.html and
recompile you won't be able to run more than about 500 child processes
at the same time on the same parent.

If you continue reading the above post you will also see more that
might be of interest to you.

On Wed, Jan 6, 2016 at 4:08 PM,   wrote:
> Really good points Michel, thank you for describing so clearly!If we're
> talking solely about multiple picolisp processes, then there is built-in
> picolisp IPC for picolisp processes started by the same common parent
> process.Check out: (fork) (tell) (kids) (hear) and the functions in
> @lib/boss.lThere are also coroutines (co) and (task) / *Run@Lawrence:Still
> theorizing over theoretical properties?I recommend to do a little benchmark
> project or a little proof of concept of what you want to do. General
> discussion/research is good to get a rough overview, but will hardly give
> you an answer for a concrete case, then better do a prototype.And don't
> forget there is no golden language being the perfect tool for every person
> and every project, technical features of a language is just one property of
> many to take into account.-beneroth- Original Message -From: Michel
> Pelletier [mailto:pelletier.mic...@gmail.com]To:
> picolisp@software-lab.deSent: Tue, 5 Jan 2016 18:56:04 -0800Subject: Re:
> picolisp and erlang in distributed/concurrent processingThis is an
> interesting question that I have a few thoughts on.First, is that picolisp
> is so "light" and has such a minimal memoryfootprint, that it's easy to use
> multiprocessing to many picolisp processesrunning on a machine, or a in a
> container. Multiprocessing has areputation of being slow and expensive, but
> that's not really my experienceon Linux. One the advantages I believe is
> that the entire interpreter canpretty much fit in processor cache, and all
> processes benefit.Forks are nice in that they share nothing, so you need
> some kind of sharenothing IPC. The awesome aw wrote some nanomsg bindings
> for picolisp thatdo the job very well:
> https://github.com/aw/picolisp-nanomsg You can alsouse mmap simply enough to
> share memory between processes. This provides youwith all the parts you need
> to undertake all kinds of "actor" like patterns.Erlang, Elixir, and Go all
> use a concurrency technique called CommunicatingSequential Processes (CSP).
> This uses an explicit, synchronous "channel"abstraction to pass messages
> between processes and define rendezvouspoints. Processes talk on channels
> instead of explicitly named actorendpoints. As this link points out, there
> are a lot of overlap infunctionality with actor models, and they can both
> easily emulate
> eachother.https://en.wikipedia.org/wiki/Communicating_sequential_processes#Comparison_with_the_Actor_ModelNanomsg
> kind of give you the best of both worlds, with synchronous andasynchronous
> passing using either the actor abstraction or "channels" usingvarious
> routing policies (pub/sub, many to many, surveying, etc.)My 2c.-MichelOn
> Tue, Jan 5, 2016 at 5:50 PM, Lawrence Bottorff  wrote:>
> If Erlang is a perfect 10 (or not!) in the world of distributed,>
> concurrent, load-sharing networked interoperable (etc., etc.) software,>
> what does picolisp bring to the table? What can I do along these lines in>
> picolisp? Erlang allows a node to have thousands of "light' processes. How>
> does picolisp do this?>> LB>
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Issue with wait

2016-01-04 Thread Henrik Sarvell
Yes, very easy indeed :)

I actually tried to google for it but I used the wrong search terms.

On Mon, Jan 4, 2016 at 8:02 AM, Alexander Burger  wrote:
> Hi Henrik,
>
>> "In fact, it has. 'wait' always first checks for pending events before
>> it goes to sleep."
>>
>> Why does it do that?
>
> This is exactly the purpose of 'wait': Wait for events. The milliseconds
> are just a timeout value.
>
>
>> If I had access to a wait that simply stops
>> execution and nothing else everything would be good, I tried to create
>> one of my own but it uses too much CPU in the loop.
>
> Well, that's easy:
>
>(call 'sleep 2)
>
> Also (at least on Linux) this works:
>
>(call 'sleep "0.1")
>
>
>> "If there are data available on that socket already, that task will be
>> executed."
>>
>> It is listening (subscribing) for data so there is no data available
>> to begin with.
>
> But there must be something, otherwise it would not wake up. Try to
> (trace '...) or '$ strace ...' it.
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Issue with wait

2016-01-04 Thread Henrik Sarvell
Turns out you were right, didn't help with call sleep as the task
waiting for websocket connections got "blocked" instead.

I worked around it by simply doing a small publish on the same socket
immediately after subscribing to get something on the channel. Ugly
but works.

>From the Redis page above: "The replies to subscription and
unsubscription operations are sent in the form of messages, so that
the client can just read a coherent stream of messages where the first
element indicates the type of message."

Seems like I'm doing something wrong because I'm simply not able to
get at that initial reply, in fact it looks like it's coming when the
first publish happens, which I'm now forcing.


On Mon, Jan 4, 2016 at 10:34 AM, Henrik Sarvell <hsarv...@gmail.com> wrote:
> Yes, very easy indeed :)
>
> I actually tried to google for it but I used the wrong search terms.
>
> On Mon, Jan 4, 2016 at 8:02 AM, Alexander Burger <a...@software-lab.de> wrote:
>> Hi Henrik,
>>
>>> "In fact, it has. 'wait' always first checks for pending events before
>>> it goes to sleep."
>>>
>>> Why does it do that?
>>
>> This is exactly the purpose of 'wait': Wait for events. The milliseconds
>> are just a timeout value.
>>
>>
>>> If I had access to a wait that simply stops
>>> execution and nothing else everything would be good, I tried to create
>>> one of my own but it uses too much CPU in the loop.
>>
>> Well, that's easy:
>>
>>(call 'sleep 2)
>>
>> Also (at least on Linux) this works:
>>
>>(call 'sleep "0.1")
>>
>>
>>> "If there are data available on that socket already, that task will be
>>> executed."
>>>
>>> It is listening (subscribing) for data so there is no data available
>>> to begin with.
>>
>> But there must be something, otherwise it would not wake up. Try to
>> (trace '...) or '$ strace ...' it.
>>
>> ♪♫ Alex
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Websockets now considered stable

2016-01-04 Thread Henrik Sarvell
Update:

The socketserver is now completely reliant on Redis, using Redis' pub
/ sub functionality: http://redis.io/topics/pubsub

The reason for this is that I was using the websocket server to handle
all websockets functionality for the site I'm being paid to work on
and it started running into problems as the site grew, the first issue
was an easy fix after Alex pointed me to it, increasing the amount of
file descriptors in src64/sys/x86-64.linux.defs.l, my line #115 now
looks like this: (equ FD_SET 1024)  # 1024 bit

After re-compiling I could easily handle more than 500 clients and all
was well for a while.

Unfortunately the site is growing so fast that just some month(s)
later the parent / root process started intermittently running at 100%
CPU utilization and the service stopped working for perhaps 10-20
minutes before resolving on its own. At this point peak usage involved
2000 clients being connected at the same time.

Alex suspects that the issue has got to do with how the internal logic
handles new processes being created when there are already a lot of
them present. In a normal HTTP server scenario this probably never
happens, imagine that every request takes on average 1 second to
perform before the socket closes, you would then need about 2000
requests per second in order to trigger the CPU problem, you'll run
into many other issues long before that happens in a non-trivial
scenario (trust me I've tested).

In the end we switched over to a node.js based solution that also
relies on Redis' pub / sub functionality (that's where I got the idea
from to make the PL based solution also use it).

I have tried to replicate the real world situation load wise and
number of clients wise but not been able to trigger the CPU issue
(this also seems to imply that Alex's suspicion is not completely on
target), it's impossible for me to replicate the real world situation
since I can't commandeer hundreds of machines all over the world to
connect to my test server. What I did manage to trigger though was
fairly high CPU usage in the child processes though, a situation that
also involved loss of service. After the switch to using pub / sub I
haven't been able to trigger it, so that's a win at least.

Now for the real improvement, actually making HTTP requests to publish
something becomes redundant when publishing from server to client
since it's just a matter of issuing a publish call directly to Redis
instead. That lowers the amount of process creation by more than 90%
in my use case.

Even though I can't be 100% sure as it currently stands I believe that
if I had implemented the websocket server using Redis' pub / sub to
begin with the CPU issue would probably never have happened and there
would've been no need to switch over to node.js.

That being said, this type of service / application is better suited
for threads since the cost in RAM etc is lower.

Final note, my decision to use one socket per feature was poor, it
allowed me a simpler architecture but had I opted for one socket with
"routing" logic implemented in the browser instead I could have
lowered the amount of simultaneous sockets up to 8 times. Peak usage
would then have been 2000 / 8 = 250 processes. Not only that, it turns
out that IE (yes, even version 11 / edge) only allows 6 simultaneous
sockets (including in iframes) per page. We've therefore been forced
to turn off for instance the tournament functionality for IE users.



On Fri, Jun 26, 2015 at 9:30 PM, Henrik Sarvell <hsarv...@gmail.com> wrote:
> Hi all, after over a month without any of the prior issues I now
> consider the websockets part of pl-web stable:
> https://bitbucket.org/hsarvell/pl-web Gone are the days of 100% CPU
> usage and zombie processes.
>
> With Alex's help the main web server is now more stable (he made me
> throw away a few throws in favour of a few byes). The throws were
> causing the zombies.
>
> I was also including dbg.l (it was causing hung processes at 100%
> CPU), it's basically been deprecated or something, I'll leave it up to
> him to elaborate. It's just something I've been including by habit
> since years ago when at some point I needed to include it to do some
> kind of debugging.
>
> Anyway atm the WS router is regularly routing up to 40 messages per
> second to upwards 300-500 clients which means that roughly 20,000
> messages are being pushed out per second during peak hours.
>
> The PL processes show up with 0 CPU and 0 RAM usage when I run top,
> sometimes 1% CPU :) They hardly register even i aggregate, the server
> would be running 99% idle if it was only running the WS server.
>
> To work around the inter-process limit of 4096 byte long messages the
> router now supports storing the messages in Redis (raw disk is also
> supported if Redis is not available), this is also in effect in
> production and is working flawlessly since months.
>

Re: Issue with wait

2016-01-03 Thread Henrik Sarvell
Hi Alex, thanks for that clarification.

"In fact, it has. 'wait' always first checks for pending events before
it goes to sleep."

Why does it do that? If I had access to a wait that simply stops
execution and nothing else everything would be good, I tried to create
one of my own but it uses too much CPU in the loop.

"If there are data available on that socket already, that task will be
executed."

It is listening (subscribing) for data so there is no data available
to begin with.

"where I don't know what '*RedisOnSubRes' contains"

It contains: (println (last *RedisSubRes))

I would be fine if I didn't need a loop at the end that needs to wait
a certain amount of time, the loop is needed to ping the client to
check that it is alive (it will respond with pong if it is):
https://bitbucket.org/hsarvell/pl-web/src/default/pl-web.l?at=default=file-view-default
(line 368).


On Sun, Jan 3, 2016 at 9:45 AM, Alexander Burger <a...@software-lab.de> wrote:
> Hi Henrik,
>
> On Sat, Jan 02, 2016 at 10:34:25PM +0100, Henrik Sarvell wrote:
>> I've recently implemented pub / sub ( http://redis.io/topics/pubsub )
>> in my redis class (
>> https://bitbucket.org/hsarvell/ext/src/default/redis.l?fileviewer=file-view-default
>> ).
>
> Cool!
>
>
>> (subscribe> R "foo")
>> #(wait 1)
>> (println "finished")
>>
>> with ./pil subscribe.l in /opt/picolisp you will see "finished".
>>
>> If you uncomment the wait line you will not see "finished", the script
>> stops on (wait 1) and I have no idea why.
>>
>> Since I don't pass in a second argument I would assume that wait has
>> nothing to do with the *Run global in this case and that execution
>> will simply pause for one millisecond and then continue but this does
>> not happen.
>
> In fact, it has. 'wait' always first checks for pending events before it
> goes to sleep. In 'subscribe>' you start a task on the socket. If there
> are data available on that socket already, that task will be executed. I
> can't reproduce your setup, but the task calls
>
>(run *RedisOnSubRes)
>
> where I don't know what '*RedisOnSubRes' contains, but I recommend you
> trace that one to see where it hangs.
>
>
>> So execution continues as soon as we get something back on the socket
>> we have established.
>
> Yes, exactly.
>
>
>> I don't get why wait literally needs something coming into (in ... )
>> in order to allow continued execution in this case.
>
> If nothing would be coming in, 'wait' would indeed sleep just for
> a millisecond and then return. So it must be the scenario described
> above.
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Emacs REPL not "full-featured"?

2016-01-02 Thread Henrik Sarvell
If the issue is only about jumping to docs perhaps picolisp-jump in my
emacs init file might be of help:
http://www.prodevtips.com/2015/02/18/my-emacs-init-file-for-2015/

On Sat, Jan 2, 2016 at 11:43 AM, Alexis  wrote:

>
> Lawrence Bottorff  writes:
>
> I've got a REPL started in Emacs (called from ELPA version of picolisp
>> major mode with run-picolisp)
>>
>
> The only picolisp-mode i'm aware of that's on an ELPA is my picolisp-mode
> on MELPA:
>
> http://melpa.org/#/picolisp-mode
>
> As the documentation on that page notes, this mode is not related to the
> one bundled with PicoLisp[1]. In particular, it does not contain a command
> `run-picolisp` (such non-namespace-prefixed names are nowadays considered
> poor ELisp programming style). So it sounds like you're actually using the
> bundled-with-PicoLisp mode, not the mode available on MELPA, i.e. the
> former is loaded and shadowing the latter.
>
>
> Alexis.
>
> [1] For a discussion on why my package on MELPA still has the same name as
> the one bundled with PicoLisp, cf.
> https://github.com/milkypostman/melpa/issues/2514.
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Questions about EmuLisp

2016-01-02 Thread Henrik Sarvell
Hi Christophe.

AFAIK ClojureScript is pretty much feature complete as opposed to Emu,
there's a risk for confusion and perhaps bad PR if an online REPL
based on Emu becomes the de facto way of playing around with PL for
novices, ie "Why can't I do X which the manual seems to imply?!!" or
"This crap sucks, it can't even do Y." when it in fact can do Y.

Some prominent disclaimer should be there, perhaps with information on
what features are not available.

The fact that PL is now apt-get installable makes it trivial to test
out the real thing too.




On Sat, Jan 2, 2016 at 9:40 PM, Christophe Gragnic
 wrote:
> Hi all,
>
> These are primarily questions for Alex, but I'm interested
> in the answers of other people too.
>
> I'm a big fan of PicoLisp even if I only scratched the surface yet,
> since I don't use the server or the DB.
> I know most of the heavy PicoLisp users here rely extensively
> on the server and the DB and wouldn't use Ersatz for real things.
> So bear with me for questions about EmuLisp,
> which is even "weaker" that Ersatz!
>
> 1) What do you think of EmuLisp?
> 2) Would you promote it?
> 3) Would you use it on the futur website for the demo REPL?
> 4) I'm beginning a journey to the understandings of
> Clojure/ClojureScript and would love to see something
> like this for PicoLisp. Does this ring a bell for someone?
>
> For your information, there is now a NodeJS module:
> https://www.npmjs.com/package/emulisp
>
>
> chri
>
> --
>
> http://profgra.org/lycee/ (site pro)
> http://delicious.com/profgraorg (liens, favoris)
> https://twitter.com/profgraorg
> http://microalg.info (langage de programmation pédagogique)
> http://expressions.club/ (structure des expressions mathématiques)
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Issue with wait

2016-01-02 Thread Henrik Sarvell
I've recently implemented pub / sub ( http://redis.io/topics/pubsub )
in my redis class (
https://bitbucket.org/hsarvell/ext/src/default/redis.l?fileviewer=file-view-default
).

Redis is apt get installable in Ubuntu 14.04: sudo apt-get install
redis-server, it will start and just work immediately without further
action.

If you put the whole ext project in /opt/picolisp/ext and run this script:

(load
   "lib.l"
   "ext/base.l"
   "ext/redis.l" )

(de *RedisOnSubRes
   (println (last *RedisSubRes)) )

(setq R (new '(+Redis)))
(connect> R)
(subscribe> R "foo")
#(wait 1)
(println "finished")

with ./pil subscribe.l in /opt/picolisp you will see "finished".

If you uncomment the wait line you will not see "finished", the script
stops on (wait 1) and I have no idea why.

Since I don't pass in a second argument I would assume that wait has
nothing to do with the *Run global in this case and that execution
will simply pause for one millisecond and then continue but this does
not happen.

Extra detail: if you run with the wait line uncommented and start
redis-cli in a different shell followed by the command PUBLISH pl-foo
hello you will see "finished" in the first shell.

So execution continues as soon as we get something back on the socket
we have established.

I don't get why wait literally needs something coming into (in ... )
in order to allow continued execution in this case.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: bitmaps from random

2015-12-21 Thread Henrik Sarvell
Neat trick to test RNGs, so obvious in hindsight.

On Mon, Dec 21, 2015 at 3:49 PM, Mike Pechkin 
wrote:

> yes, influenced by
> http://goo.gl/zhTijq
>
>
> On Mon, Dec 21, 2015 at 3:43 PM, Mike Pechkin 
> wrote:
>
>> hi,
>>
>> bitmaps from (rand) from pil32 and pil64
>> done by "convert" from ImageMagic soft.
>>
>> now looks ok.
>> http://imgur.com/a/bYaAr
>>
>> Mike
>>
>>
>


Re: PicoLisp Website

2015-12-19 Thread Henrik Sarvell
Nice stuff, I like the copy too! :-)

On Fri, Dec 18, 2015 at 8:50 PM, Rick Hanson  wrote:

> Thanks, Christophe, for putting this up. I'm now like AW, I'm only on the
> phone.
>
> Anyway, first thought upon loading the site: Star Trek  :)  I love
> it!  Great job!
> On Dec 18, 2015 1:49 PM, "Christophe Gragnic" 
> wrote:
>
>> On Fri, Dec 18, 2015 at 7:17 PM, Erik Gustafson
>>  wrote:
>> > Sure thing! I'll send a few screenshots when I'm back at my computer in
>> a
>> > couple hours.
>>
>> I brutally «saved as» a local version then uploaded it here:
>>
>> http://fezzik.free.fr/picolisp/
>>
>>
>> chri
>>
>> --
>>
>> http://profgra.org/lycee/ (site pro)
>> http://delicious.com/profgraorg (liens, favoris)
>> https://twitter.com/profgraorg
>> http://microalg.info (langage de programmation pédagogique)
>> http://expressions.club/ (structure des expressions mathématiques)
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
>>
>


Re: Hosting PicoLisp

2015-12-14 Thread Henrik Sarvell
Here's how I do locally, see the bottom of this text:
https://bitbucket.org/hsarvell/macropis

On Sun, Dec 13, 2015 at 10:34 PM, Yiorgos Adamopoulos
 wrote:
> On Sun, Dec 13, 2015 at 11:05 PM, Tomas Hlavaty  wrote:
>> possible to rent such machines for about 5 EUR/month these days, which
>> should be more than enough for any picolisp app.
>
> Digital Ocean is one such provider. Instead of apache in front of
> picolisp I would go with nginx following the lines of this tutorial
>
> https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache
>
>
> --
> "If technology is your thing plan to die reading manuals" --Gene Woolsey
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Gorlansky lisp book, 800+ tasks

2015-08-27 Thread Henrik Sarvell
Can the book be freely accessed somewhere so that it's possible see the
descriptions of the tasks that you solved?

On Thu, Aug 27, 2015 at 9:35 AM, Mike Pechkin mike.pech...@gmail.com
wrote:

 hi,

 With important backbone support from Mr.Burger all tasks were implemented.
 Sources are here:

 https://bitbucket.org/mihailp/tankfeeder/src/8a5a482c9e19c57d533703e0d2bdcdc92f44c1ae/gorlansky/?at=default

 Notes:
 o) diamond in bucket of rocks is task #4.306 (from prefix to postfix)
 o) #17.6 task implemented in PicoLisp Prolog
 o) some tasks ignored
 o) PDF book in repo (russian)
 o) tested in Linux, *BSD, Solaris, AIX, HPUX, Cygwin
 o) Comments, patches, objections and polish stuff are welcome.

 p.s.
 Alexander Burger (author of PicoLisp) is free for hiring.
 CV available by request.http://software-lab.de

 Mike




Re: Websockets now considered stable

2015-07-02 Thread Henrik Sarvell
Hi Rick, seems like a fix would be a check there: if sessions dir doesn't
exist (and Redis isn't used to store the session) create it and move on
instead of breaking down in tears.

On Sun, Jun 28, 2015 at 10:47 PM, Rick Hanson cryptor...@gmail.com wrote:

 I downloaded pl-web and ext and ran the demo-app.  When I went to the
 login page, I got this Open error in the console:

 # excmd redefined
 # exlst redefined
 # exlst redefined
 !? (out Sf (print (list (list sid *Sid

 /home/rick/projects/pl-web-demo/./sessions/6d61fa61b9cc1d8fd878f4b534703473
 -- Open error: No such file or directory
 ?

 But after I quit, issued a:

 $ mkdir sessions

 and re-started the server, I never got the error again -- everything
 worked as expected.  (I got the login creds from main.l.)
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Websockets now considered stable

2015-06-26 Thread Henrik Sarvell
Hi all, after over a month without any of the prior issues I now
consider the websockets part of pl-web stable:
https://bitbucket.org/hsarvell/pl-web Gone are the days of 100% CPU
usage and zombie processes.

With Alex's help the main web server is now more stable (he made me
throw away a few throws in favour of a few byes). The throws were
causing the zombies.

I was also including dbg.l (it was causing hung processes at 100%
CPU), it's basically been deprecated or something, I'll leave it up to
him to elaborate. It's just something I've been including by habit
since years ago when at some point I needed to include it to do some
kind of debugging.

Anyway atm the WS router is regularly routing up to 40 messages per
second to upwards 300-500 clients which means that roughly 20,000
messages are being pushed out per second during peak hours.

The PL processes show up with 0 CPU and 0 RAM usage when I run top,
sometimes 1% CPU :) They hardly register even i aggregate, the server
would be running 99% idle if it was only running the WS server.

To work around the inter-process limit of 4096 byte long messages the
router now supports storing the messages in Redis (raw disk is also
supported if Redis is not available), this is also in effect in
production and is working flawlessly since months.

This is how I start the WS server in production:

(load pl-web/pl-web.l)

(setq *Mobj (new '(+Redis) pl-ws-))

(undef 'app)

(setq *WsAuth '((notifications ((send (put your password/key here))

(de app ()
   (splitPath)
   (wsApp)
   (bye))

(de go ()
   (wsServer)
   (server 9090) )
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Websockets now considered stable

2015-06-26 Thread Henrik Sarvell
Hi Andreas.

1) As far as I remember from a discussion with Alex it's a hard
limit (OS related).

2) Line 369 - 372 here:
https://bitbucket.org/hsarvell/pl-web/src/c445ca3861159d0b28ea779a183572c91b7b8458/pl-web.l?at=default



On Fri, Jun 26, 2015 at 9:50 PM,  andr...@itship.ch wrote:
 Hi Henrik

 Awesome! That's really cool, thank you for your effort and for sharing the 
 code :-)
 20k message with nearly zero server load sounds very impressive.

 Question:
 To work around the inter-process limit of 4096 byte long messages the
 router now supports storing the messages in Redis

 1) Where comes this limit from?
 POSIX IPC? PicoLisp IPC ?

 2) I couldn't find the redis part in the code, maybe you can give me a hint 
 where to look?


 Thanks, your work on websockets will definitely help me in in the future :-)
 - beneroth



 - Original Message -
 From: Henrik Sarvell [mailto:hsarv...@gmail.com]
 To: picolisp@software-lab.de
 Sent: Fri, 26 Jun 2015 21:30:58 +0200
 Subject:

 Hi all, after over a month without any of the prior issues I now
 consider the websockets part of pl-web stable:
 https://bitbucket.org/hsarvell/pl-web Gone are the days of 100% CPU
 usage and zombie processes.

 With Alex's help the main web server is now more stable (he made me
 throw away a few throws in favour of a few byes). The throws were
 causing the zombies.

 I was also including dbg.l (it was causing hung processes at 100%
 CPU), it's basically been deprecated or something, I'll leave it up to
 him to elaborate. It's just something I've been including by habit
 since years ago when at some point I needed to include it to do some
 kind of debugging.

 Anyway atm the WS router is regularly routing up to 40 messages per
 second to upwards 300-500 clients which means that roughly 20,000
 messages are being pushed out per second during peak hours.

 The PL processes show up with 0 CPU and 0 RAM usage when I run top,
 sometimes 1% CPU :) They hardly register even i aggregate, the server
 would be running 99% idle if it was only running the WS server.

 To work around the inter-process limit of 4096 byte long messages the
 router now supports storing the messages in Redis (raw disk is also
 supported if Redis is not available), this is also in effect in
 production and is working flawlessly since months.

 This is how I start the WS server in production:

 (load pl-web/pl-web.l)

 (setq *Mobj (new '(+Redis) pl-ws-))

 (undef 'app)

 (setq *WsAuth '((notifications ((send (put your password/key here))

 (de app ()
(splitPath)
(wsApp)
(bye))

 (de go ()
(wsServer)
(server 9090) )
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

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


Re: https server side

2015-05-27 Thread Henrik Sarvell
I do WSS via httpGate with a CA signed certificate, see this article under
the WSS section: http://picolisp.com/wiki/?Websockets

On Wed, May 27, 2015 at 8:13 AM, Alexander Burger a...@software-lab.de
wrote:

 On Wed, May 27, 2015 at 07:25:59AM +0200, Alexander Burger wrote:
  The file names holds a configuration for the servers to be started.
  This is the part which still needs to be documented.

 Hmm, actually this is rather simple.


 Create a file with one server per line. For example, here some lines
 from my config file for the wiki and some demo apps:

app 8080 app  /home/app  log/app./pil app/main.l lib/app.l
 -main app/_patch.l -go -wait
wiki5000 app  /home/app  log/wiki   ./pil wiki/main.l lib/app.l
 -main wiki/_patch.l -go -wait
sushi  22000 app  /home/app  log/sushi  ./pil sushi/main.l lib/app.l
 -main -go -wait
menu   24000 app  /home/app  log/menu   ./pil menu/main.l lib/app.l
 -main -go -wait
canvas 27002 app  /home/app  log/canvas ./pil misc/canvas.l lib/app.l
 -main app/_patch.l -go -wait
phone  27003 app  /home/app  log/phone  ./pil misc/phone.l lib/app.l
 -main app/_patch.l -go -wait
osm27004 app  /home/app  log/osm./pil osm/main.l lib/app.l
 -main app/_patch.l -go -wait

 i.e. the arguments, separated by spaces, are:

1. The name of the application
2. The port where this server should listen at
3. The user name
4. The working directory of the server process
5. The log file where stdout and stderr should be redirected to
6. The command line to start the server process

 (For optimal access if you have really many servers, you should
 'balance' the contents of the config file. That's left as a task to the
 reader)


 When a client requests e.g.

https://7fach.de/canvas

 this server will be started. That is, the name 'canvas' is looked up,
 and 'httpGate' checks if a process is listening at 27002. If not, it
 starts that process.

 The 'go' function of the server (see the example in app/main.l) may
 call

(retire 20)

 This will cause this server to stop if there are no child processes and
 no activities for 20 minutes.

 'httpGate' sends the NAME of the application under which it was invoked,
 and the PORT it should listen at, in environment variables. Thus, the
 'server' call is

(server (or (format (sys PORT)) 8080) !work) )

 It uses the PORT passed in, or defaults to 8080.


 In that way you may have thousands of client application running on a
 single machine, each one only started and stopped as necessary.

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



Re: MySQL native C wrapper

2015-05-01 Thread Henrik Sarvell
I've now updated, due to time constraints I have not done the following:

1.) Linked straight to the mysql client library as I still need to call my
conn function in mysql.c, in order to get rid of it one first needs to call
mysql_init to get the connection struct, so far so good but then calling
mysql_real_connect and being able to get the updated pointer properly
requires somehow mapping the struct on line 242 in
/usr/include/mysql/mysql.h in the call, too much; didn't do that.

2.) Some kind of proper query builder, there are some helper functions in
the form of the mk*s.

Due to time constraints I believe I'm done for now for the foreseeable
future.




On Mon, Apr 27, 2015 at 10:14 AM, Henrik Sarvell hsarv...@gmail.com wrote:

 Yes, you're right, I'll remove it and link straight to the lib, it
 was something I did in the beginning of the process when I was unsure
 of how transparently I could pass references to structs around.

 As it turned out it's completely seamless so your suggestion makes
 perfect sense, or be my guest and do it yourself if you're anxious, I
 won't have time until next weekend, feel free to copy whatever you
 like from me.

 On Mon, Apr 27, 2015 at 3:28 AM, Alexander Williams
 a...@unscramble.co.jp wrote:
  Henrik this is great!!
 
  I've been looking for something like this but it was a little lower on
 my priority list. Thank you!
 
  I find it interesting that you wrote some C to initiate the mysql
 connection Would it be easier to do it in PicoLisp and simply use
 libmysqlclient.so ?
 
  On 2015-04-27, at 6:00 AM, Henrik Sarvell hsarv...@gmail.com wrote:
 
  Hi list, I'm announcing this at a very early stage, earlier than I
  would like to, in case someone else is also thinking about doing a
  MySQL wrapper, to avoid duplicate work.
 
  I'm not doing this because I think that MySQL is in any way a better
  alternative than the native DB functionality, rather the opposite.
 
  The main reasoning is that it might help adoption of the language as
  I've come to believe that how the data is stored could be as big a
  hurdle to switch as the language switch itself - for many
  organisations - if they can keep their data as it is (to begin with)
  half the battle might already be won.
 
  PicoLisp with MySQL is still better than say PHP with MySQL.
 
  It also helps in migrating from MySQL to the native DB.
 
  It's all inspired by Alex Williams' nice and instructive use of the
  native stuff here: http://aw.github.io/picolisp//2015/02/22/nanomsg/
 
  And I couldn't have managed without AB's writeup here:
  http://software-lab.de/doc/native.html
 
  Without further ado:
  https://bitbucket.org/hsarvell/ext/src/default/mysql.l?at=default
 
  Note that you can't just run with the file linked to above, you need
  the mysql.so file in the ext/so folder too.
 
  If no one beats me to it I will do some more work on this one in the
  future and will announce here when there's something to show.
  --
  UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
  --
  UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe



Re: MySQL native C wrapper

2015-04-27 Thread Henrik Sarvell
Yes, you're right, I'll remove it and link straight to the lib, it
was something I did in the beginning of the process when I was unsure
of how transparently I could pass references to structs around.

As it turned out it's completely seamless so your suggestion makes
perfect sense, or be my guest and do it yourself if you're anxious, I
won't have time until next weekend, feel free to copy whatever you
like from me.

On Mon, Apr 27, 2015 at 3:28 AM, Alexander Williams
a...@unscramble.co.jp wrote:
 Henrik this is great!!

 I've been looking for something like this but it was a little lower on my 
 priority list. Thank you!

 I find it interesting that you wrote some C to initiate the mysql connection 
 Would it be easier to do it in PicoLisp and simply use libmysqlclient.so ?

 On 2015-04-27, at 6:00 AM, Henrik Sarvell hsarv...@gmail.com wrote:

 Hi list, I'm announcing this at a very early stage, earlier than I
 would like to, in case someone else is also thinking about doing a
 MySQL wrapper, to avoid duplicate work.

 I'm not doing this because I think that MySQL is in any way a better
 alternative than the native DB functionality, rather the opposite.

 The main reasoning is that it might help adoption of the language as
 I've come to believe that how the data is stored could be as big a
 hurdle to switch as the language switch itself - for many
 organisations - if they can keep their data as it is (to begin with)
 half the battle might already be won.

 PicoLisp with MySQL is still better than say PHP with MySQL.

 It also helps in migrating from MySQL to the native DB.

 It's all inspired by Alex Williams' nice and instructive use of the
 native stuff here: http://aw.github.io/picolisp//2015/02/22/nanomsg/

 And I couldn't have managed without AB's writeup here:
 http://software-lab.de/doc/native.html

 Without further ado:
 https://bitbucket.org/hsarvell/ext/src/default/mysql.l?at=default

 Note that you can't just run with the file linked to above, you need
 the mysql.so file in the ext/so folder too.

 If no one beats me to it I will do some more work on this one in the
 future and will announce here when there's something to show.
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


MySQL native C wrapper

2015-04-26 Thread Henrik Sarvell
Hi list, I'm announcing this at a very early stage, earlier than I
would like to, in case someone else is also thinking about doing a
MySQL wrapper, to avoid duplicate work.

I'm not doing this because I think that MySQL is in any way a better
alternative than the native DB functionality, rather the opposite.

The main reasoning is that it might help adoption of the language as
I've come to believe that how the data is stored could be as big a
hurdle to switch as the language switch itself - for many
organisations - if they can keep their data as it is (to begin with)
half the battle might already be won.

PicoLisp with MySQL is still better than say PHP with MySQL.

It also helps in migrating from MySQL to the native DB.

It's all inspired by Alex Williams' nice and instructive use of the
native stuff here: http://aw.github.io/picolisp//2015/02/22/nanomsg/

And I couldn't have managed without AB's writeup here:
http://software-lab.de/doc/native.html

Without further ado:
https://bitbucket.org/hsarvell/ext/src/default/mysql.l?at=default

Note that you can't just run with the file linked to above, you need
the mysql.so file in the ext/so folder too.

If no one beats me to it I will do some more work on this one in the
future and will announce here when there's something to show.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: PicoLisp on machines with more than 32 gigabyte of RAM?

2015-03-12 Thread Henrik Sarvell
Not that I actually need it but the websocket server currently runs on a
machine with 128GB RAM.

Works just fine, the websocket router currently juggles hundreds of
concurrent and persistent connections without using noticeable amounts of
RAM and CPU.

Due to a mistake I made processes would sometimes start to use 100% of a
core (there are 16 of them), I just noticed it by coincidence because it
didn't affect the performance of the websocket server (since it needs so
little CPU anyway).

Hopefully I just uploaded a fix but more on that in a future post if it
indeed did fix the problem.


On Thu, Mar 12, 2015 at 2:33 PM, Jakob Eriksson ja...@aurorasystems.eu
wrote:


 http://www.infoq.com/news/2015/03/petabyte-jvms?utm_source=hacker%20newsutm_medium=linkutm_campaign=petabyte%20news

 They describe a machine with NUMA, and basically run a handful of JVMs,
 each
 confined to a NUMA region. Then synchronize with a huge disk cluster.

 I wonder how PicoLisp would fare on large machines with large sets of data?

 I have a feeling really great. :)

 Has someone on the list tried PicoLisp on a monster PC?

 best regards,
 Jakob
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe



Re: Calm my fears please. . . .

2015-03-09 Thread Henrik Sarvell
When doing web development of the CRUD type the lack of type checking and
the incessant whining that results from wrong types is one of the biggest
productivity boosts that can be had.


On Mon, Mar 9, 2015 at 7:13 AM, Alexander Burger a...@software-lab.de
wrote:

 Hi Lawrence,

  monads. Does the Lisp world, specifically picoLisp, have a response to
  these insistent Besserwisser people?

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



Re: A PicoLisp native library tutorial

2015-03-03 Thread Henrik Sarvell
Nice!

On Tue, Mar 3, 2015 at 5:36 PM, Alexander Williams
a...@unscramble.co.jp wrote:
 Hi list,

 Some of you might know me from IRC @aw-Unscramble.

 I've written my first PicoLisp library, a native C binding for Nanomsg
 (picolisp-nanomsg) - as an experiment for myself to learn this language.

 In doing so, I ran into a few difficulties (mostly noob stuff) but Regenaxer
 has been very helpful and patient.

 I also wrote a tutorial explaining the code, to help other newbies
 understand some useful features of PicoLisp:

   https://github.com/aw/picolisp-nanomsg/blob/master/EXPLAIN.md

 And of course, the library: https://github.com/aw/picolisp-nanomsg


 Thanks!

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


Re: Rosetta Code !!!

2015-02-20 Thread Henrik Sarvell
Mostly Alexander Burger but I believe another person also did a few,
can't remember who though...

On Fri, Feb 20, 2015 at 2:07 AM, Lawrence Bottorff borg...@gmail.com wrote:
 Just saw the picoLisp contribution for picoLisp. Enormous! Who did all that
 work?

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


Re: Installation issues

2015-02-17 Thread Henrik Sarvell
To complicate things I've attached my two local versions of picolisp.el and
inferior-picolisp.el

When I diff them I see quite substantial differences.

Unfortunately I have no idea why I made those changes as I didn't take any
notes and it was several years ago.



On Tue, Feb 17, 2015 at 7:12 AM, Alexander Burger a...@software-lab.de
wrote:

 Hi list,

 as I mentioned in my previous mail, is Thorsten currently offline.
 He asked me to post this for him:

 -
 Hi Alexis,
 this is Thorsten, the current maintainer (but ot original author) of
 the Emacs stuff.

 i'll try to find some time to:


 * examine the diffs between the distribution version and the GitHub
 version;
 Why? Just use the newer version, i.e. the Github version. Nobody else but
 me did change anything recently.

 * add to the former any fixes and/or extra functionality found in the
 latter;
 Again - why? Just replace the older version with the newer version ...


 * add in my code to present documentation for the symbol at point; and
 you mean an eldoc implementation for picolisp? patches are welcome, just
 fork me on github.

 * add in things like user configuration of the path to the `pil`
 executable.
 :-)
 AFAIK the path is remembered, to avoid typing, but can be changed - just
 try using a prefix before the command, that should give you the opportunity
 to type in your own path (but I'm not sure right now).

 Try C-h f on the core functions, there is quite a lot of info in the
 docstrings.
 Sorry for being late to the discussion, but I'm not really online at the
 moment.

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

;; picolisp-mode: Major mode to edit picoLisp.
;; Version: 1.1

;;; Copyright (c) 2009, Guillermo R. Palavecino

;; This file is NOT part of GNU emacs.

 Credits:
;; It's based on GNU emacs' lisp-mode and scheme-mode.
;; Some bits were taken from paredit.el
;;
 Contact:
;; For comments, bug reports, questions, etc, you can contact me via IRC
;; to the user named grpala (or armadillo) on irc.freenode.net in the
;; #picolisp channel or via email to the author's nickname at gmail.com
;;
 License:
;; This work is released under the GPL 2 or (at your option) any later
;; version.

(require 'lisp-mode)

(defcustom picolisp-parsep t
  This is to toggle picolisp-mode's multi-line s-exps closing parens separation capability.
  :type 'boolean
  :group 'picolisp )

;; I know... this shouldn't be here, but you see, people may want to keep
;; their body-indent value unaltered and have a different one for picolisp
;; sources, so...
(defcustom picolisp-body-indent 3
  Number of columns to indent the second line of a `(de ...)' form.
  :group 'picolisp
  :type 'integer )

(defvar picolisp-mode-syntax-table
  (let ((st (make-syntax-table))
(i 0) )

;; Default is atom-constituent.
(while ( i 256)
  (modify-syntax-entry i _st)
  (setq i (1+ i)) )

;; Word components.
(setq i ?0)
(while (= i ?9)
  (modify-syntax-entry i wst)
  (setq i (1+ i)) )
(setq i ?A)
(while (= i ?Z)
  (modify-syntax-entry i wst)
  (setq i (1+ i)) )
(setq i ?a)
(while (= i ?z)
  (modify-syntax-entry i wst)
  (setq i (1+ i)) )

;; Whitespace
(modify-syntax-entry ?\t  st)
(modify-syntax-entry ?\n st)
(modify-syntax-entry ?\f  st)
(modify-syntax-entry ?\r  st)
(modify-syntax-entry ?\s  st)

;; These characters are delimiters but otherwise undefined.
;; Brackets and braces balance for editing convenience.
(modify-syntax-entry ?\[ (]   st)
(modify-syntax-entry ?\] )[   st)
(modify-syntax-entry ?{  (}   st)
(modify-syntax-entry ?}  ){   st)

;; Other atom delimiters
(modify-syntax-entry ?\( ()   st)
(modify-syntax-entry ?\) )(   st)
;; It's used for single-line comments.
(modify-syntax-entry ?#  st)
(modify-syntax-entry ?\ \st)
(modify-syntax-entry ?'  'st)
(modify-syntax-entry ?`  'st)
(modify-syntax-entry ?~  'st)

;; Special characters
(modify-syntax-entry ?,  'st)
(modify-syntax-entry ?\\ \\st)
st ) )

(defvar picolisp-mode-abbrev-table nil)
(define-abbrev-table 'picolisp-mode-abbrev-table ())

(defun picolisp-mode-variables ()
  (set-syntax-table picolisp-mode-syntax-table)
  ;;(setq local-abbrev-table picolisp-mode-abbrev-table)
  (make-local-variable 'paragraph-start)
  (setq paragraph-start (concat $\\| page-delimiter))
  ;;(setq comint-input-ring-file-name ~/.pil_history)

  (make-local-variable 'paragraph-separate)
  (setq paragraph-separate paragraph-start)

  (make-local-variable 'paragraph-ignore-fill-prefix)
  (setq paragraph-ignore-fill-prefix t)

  (make-local-variable 'fill-paragraph-function)
  (setq fill-paragraph-function 'lisp-fill-paragraph)
  ;; Adaptive fill mode gets in the way of auto-fill,
  ;; and should make 

Re: Installation issues

2015-02-13 Thread Henrik Sarvell
Hi Lawrence, I have no idea, I have never installed the dist version.

I usually install like at the bottom of this article:
http://picolisp.com/wiki/?Websockets

On Fri, Feb 13, 2015 at 2:39 PM, Lawrence Bottorff borg...@gmail.com
wrote:

 Is this different from the distribution version? BTW, the dist version
 doesn't seem to have a customize - mode variable for the picolisp exe or
 for pil. Again, the default seems to be /usr/bin/pil . How do I override
 this?



Re: Installation issues

2015-02-13 Thread Henrik Sarvell
Hi Alexis, if I google picolisp emacs I see the following URL as the #1
result: https://github.com/tj64/picolisp-mode

That is what I use when I code PL in Emacs, works great! I've added a few
keywords to the mode and the doc jumping in my init.el, could post both
changes here if anyone is interested.



On Fri, Feb 13, 2015 at 1:05 AM, Alexis flexibe...@gmail.com wrote:


 andr...@itship.ch writes:

  @Alexis: Just have a look into lib/el/ in your picolisp installation.


 i'm on Debian Wheezy(+updates), and having installed the available
 PicoLisp package (3.1.0.7-1), couldn't see any .el files within the
 PicoLisp directory (/usr/share/picolisp/), which doesn't have a /lib or
 /lib/el directory either. However, having downloaded the 3.1.9 tarball and
 unpacked it, i can now see the files you're talking about.

 Have i missed in the documentation where support for editing in Emacs is
 mentioned? From:

 http://picolisp.com/wiki/?Documentation

 i can't see any mention of it in any of:

 * Manual Page
 * Reference Manual
 * Common Index
 * README
 * INSTALL
 or
 * FAQ

 ...

  Maybe your efforts aren't really necessary (but surely a good exercise
 anyway).
 ...
 Maybe you should rename your emacs extensions, so it doesn't get mixed up
 with the one coming with the picolisp standard distribution.


 Well, if i'd known that Emacs support was already available, i wouldn't
 have written my package in the first place! i already maintain a couple of
 other Emacs packages, and have lots of other coding i'd like to be doing,
 so i only worked on my PicoLisp package to help myself and other Emacs
 users, rather than to learn about writing and/or packaging Emacs Lisp - the
 package as it currently stands didn't require extensive knowledge of
 PicoLisp.

 Now that i know comprehensive Emacs support for PicoLisp is available,
 i'll probably just remove my own PicoLisp package from MELPA. The only
 thing that my package provides that the distribution package doesn't - as
 far as i can tell! - is support for showing documentation for the symbol at
 point, either in a browser or in Emacs itself. i'd be happy for my code for
 that to be added to the distribution package, assuming i don't have to sign
 any paperwork to do so 



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



Re: modules?

2015-02-11 Thread Henrik Sarvell
As far as avoiding getBob clashes PL already has class and namespace
functionality.


On Tue, Feb 10, 2015 at 2:23 AM, Lawrence Bottorff borg...@gmail.com
wrote:

 I'm a total Lisp noob (and a very rusty programmer), but from OO (Java, et
 al) there is (behind the scenes, i.e., preprocessor) name mangling. There's
 also tagging stuff with a huge hash generated numbers. I say all this
 because I'm hearing the need for uniqueness and anti-name-clash -- across
 files and systems. Is that a correct assumption here? So when you call
 your getBob function, some other code you're involved with doesn't think
 that its (totally by chance also named) getBob function is meant. Am I on
 the right track?

 LB

 On Mon, Feb 9, 2015 at 7:12 PM, andr...@itship.ch wrote:

  Hi list
 
   Could we cook up a convention?
 
  Pretext
  -
  In this context I assume modules is meant not in the sense of program
  design but in the sense of software packages, a format to
 download/copy a
  piece of picoLisp code (maybe accompanied by other files, e.g. pictures)
  and insert it into your own picoLisp environment and/or picoLisp
  application and getting it running without further manual adaption.
 
  I see a potentially big advantage of such a formalized system, as it
 could
  greatly enhance picoLisp code reuse, and also work somewhat against the
  Lisp Curse [1] and the sometimes claimed lack of libraries.
 
  But it must be designed very carefully, keeping it as simple and short as
  possible, keeping it free from any assumptions (about the picoLisp
  environment or the layout of a picoLisp application) besides the absolute
  bare necessary ones, so no restrictions are put on the kind of code and
  applications using it. This thing is a easy path to bloatware, and to my
  understanding the picoLisp philosophy is all about precluding bloat.
 
  So I see following problems:
  1) identity: how to identify a module and all parts belonging to it?
(uniquely and universal)
  2) dependencies on other modules: how to verify if another module, which
  the current module depends on, is 'installed' (and functional) ?
  3) versioning of modules?
  4) upgrading/downgrading of a module version, also: being able to use
  multiple versions of a module in the same environment
  5) name clashing, especially of picoLisp code/symbols/function
 names/class
  names/etcetera
  6) lets assume modules are not only used to extend the picoLisp
  environment (e.g. stuff in @lib/), but also for applications and parts
 of
  applications - then there should probably a way to formulate which
 database
  schema / class definitions (and more!) a module requires/expects for the
  environment where it should run in.
  7) documentation - how does the interested module user find out what a
  given module does and how does he/she decide if it solves his/her needs?
  8) in which form would a module be distributed?
  9) uniform method of error reporting, especially to spot the source of an
  error in a composition of modules
  10) other problems?
 
  Oh, special question
  -
  we have package manager on OS (e.g., apt-get), now we have all this hip
  programming languages with one or even multiple package managers each,
  ruby, node.js (npm), python?, .net, java?, php (pear and another one) and
  many more.
 
  DO WE REALLY NEED TO CREATE ANOTHER ONE?
 
  Maybe we could come up with a small tool, which can take picoLisp code
  (and a bunch of files) and create a package to use with one of those
  existing module/package managers?
  I mean the question in the spirit of http://xkcd.com/927/
 
  My thoughts on solutions
  --
  (previous question ignored for the moment)
  Whenever I stumble on such common software design problems, I query the
  Wiki (that is the first original wiki, originally being a collection and
  discussion of Design Patterns).
  A first search [2] brings some nice results like What is a module [3]
  and especially the Module Dependency Problem [4] (that one we should
  definitively look at!)
  (I didn't study the Wiki entries entirely yet, so maybe there are better
  solutions mentioned there then what I think about below).
 
  I was pondering about similiar stuff before, mainly to find a good way to
  organize my own code.
  For the moment, I created a directory tgs in the picoLisp installation
  (tgs being a shortname for my personal framework).
  In this directory I have several directories for different topics, and
  within those I keep *.l-files.
  Examples:
  @tgs/log/log.l
  @tgs/time/duration.l
  @tgs/time/tz-offset.l
  @tgs/time/utc2local.l
 
  When I like to use a specific function I load the specific
  function.l-file. This can easily be done with (unless tz-offset.l (load
  @tgs/time/tz-offset.l))
  I try to keep the individual files as granular and small as possible,
  often having only one function defined in such a file, so I can load
 single
  individual 

Re: modules?

2015-02-09 Thread Henrik Sarvell
Hi Lawrence, if you're talking about something like Ruby's gems, then no.

On Mon, Feb 9, 2015 at 5:45 PM, Lawrence Bottorff borg...@gmail.com wrote:

 I'm wondering what you offer in lieu of modules (as with, say, Python). Is
 there a black box way to package up code in picoLisp that has
 module-like serviceability?

 LB



Re: Wiki: Websockets with PicoLisp, 404

2015-02-03 Thread Henrik Sarvell
Yes it can, I just haven't gotten around to updating the links.

Here is Jose's new bitbucket identity: https://bitbucket.org/iromero91/

On Mon, Feb 2, 2015 at 4:33 PM, Jon Kleiser jon.klei...@fsat.no wrote:
 Hi,

 Just want to mention that the wiki page 
 http://picolisp.com/wiki/?Websockets contains a link to web.l's websocket 
 demo https://bitbucket.org/cyborgar/web.l/src/default/webtest.l?at=default 
 that now gives a 404. Does anybody know if this demo code can be found 
 elsewhere?

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


Re: A Minimal PicoLisp DB/GUI Application, Importing

2015-01-15 Thread Henrik Sarvell
Hi Jon, maybe this script will be of help:
https://bitbucket.org/hsarvell/ext/src/tip/sqlimport.l?at=default

It's very crude but it is trying to handle the SQL - PicoDB
conversion through the constraint that you have to first run it on
table A if A is referenced in table B, and then run it again on table
B, that way you can create the +Ref on import.



On Thu, Jan 15, 2015 at 7:57 AM, Alexander Burger a...@software-lab.de wrote:
 On Wed, Jan 14, 2015 at 05:54:17PM +0100, Alexander Burger wrote:
 A simple example would be

(in myAdrDB.csv
   (while (split (line) ^I)
  (dbSync)
  (let Obj (request '(+Prs) 'nm (pack (car L)))
 (put Obj 'adr (pack (cadr L)))
 (put Obj ...)
 ... )
  (commit 'upd) ) )

 Not correct of course. Better:

(use L
   (in myAdrDB.csv
  (while (setq L (split (line) ^I))
 (dbSync)
 ... L ...
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Telephone field

2015-01-14 Thread Henrik Sarvell
Isn't this a non-issue, simply enter and store all numbers regardless
of location with country code + number without leading zero, eg
4912345678?

Will work for all countries everywhere, I never store numbers without
the country code in my mobile nowadays and always works regardless if
I'm in said country or not.



On Wed, Jan 14, 2015 at 5:23 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Jon, Luis, Rowan,

 thanks!

 I see that this problem is non-trivial. We need to extend the
 localization files loc/??.l

 Probably some functional expression or pattern needs to be stored there,
 in addition to (or as a replacement of) the country code '*CtryCode'.

 Perhaps the Google library gives the necessary information. I'll take a
 look asap. Any further input welcome!

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


Re: Syntax Highlighting in PicoLisp

2014-11-24 Thread Henrik Sarvell
I wasn't precent in the IRC but this seems to be a non-issue, if
people want syntax highlighting they can implement the VIM files
themselves, for emacs there are the files in lib/el.

FWIW, I've attached what my emacs looks like.




On Mon, Nov 24, 2014 at 10:02 AM,  andr...@itship.ch wrote:
 Hi List :-)

 Hi Christophe,

  I'm opposed to syntax highlighting of symbols in PicoLisp.

 Wao, this is quite an introduction for a post on the list !
 I guess that it is not spontaneous and may be triggered by a discussion
 on IRC?

 Correct :) Though incidentally not IRC this time, but an e-mail
 conversation.

 Maybe add a comment at the beginning regarding this, so we know too ;-)

 Anyway, this issue popped up relatively often during the last years. My
 impression was that some people naturally expect syntax highlighting, or
 even demand it, and I felt I should also make my position clear.

 There is nothing to demand, People need to learn that.
 Don't let them bugger you so much, Alex.

 It's to be expected that people ask for things they are used to from
 whatever corner of programming they come from, and we (as a community)
 should surely improve the current state of documentation and availability
 of knowlegde surrounding PicoLisp. But I personally don't see this as the
 responsibility and personal task of Alex! The amount of work he puts into
 PicoLisp and the huge efforts he makes to answer questions should be more
 then enough.

 PicoLisp is Free Software, so there is nothing to stop people to use it
 however they like. In my eyes, this also means there is NO excuse to not
 do that. No need to harass Alex, I'm pretty sure there is a way to achieve
 everything with PicoLisp by doing some research (rtfm and searching the
 mailinglist archive) or by hacking it together yourself.

 This comment I mean not just in the context of syntax style, but also
 about other missing functionality and missing library - just find a
 way yourself! And then contribute something back, share it on the mailing
 list or in the wiki on picolisp.com or just put it on your own web
 presence. (Alex is doing exactly that all the time - some others too).

 Back to topic:
 There are many editors with general lisp syntax highlighting there, even
 the emacs extensions in the official PicoLisp distribution contains one for
 picolisp.
 That one I actually use, but mainly as typo-detector,
 the bigger benefit I get from paredit-mode, which handles indentation and is
 really great for editing S-Expressions.

 For other editors, there are often simple ways to even write your own
 syntax highlighting config file, e.g. for nano (google for nanorc).

 More precisely, concerning the language I’m basing on PicoLisp, which
 is
 dedicated to beginners, I'd like to say:
 - Coloring transient symbols is important to help students spot quote
 errors
   (which may be trivial, but can occur with people not used to
 programming)

 Good point, but then you probably want a syntax highlighting customized to
 your language based on PicoLisp, and not just for Alex standard way to
 do it. Lisp evolves with the current user, so I think thats the overall
 reason why there can't be _one_right_way_.

 Have all a nice day and good start into the week,
 Andreas


Re: Tell limit?

2014-11-04 Thread Henrik Sarvell
Thanks for that.

I've slept on it and I will go for a third option, storing all the
content in a structure that looks exactly like the current routing
table that stores all the PIDs, when it arrives, to avoid sending it
as an argument via tell.

On Mon, Nov 3, 2014 at 5:20 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Henrik,

 Today I tried a somewhat longer string of HTML at which point I got
 this: Tell PIPE_BUF

 Yes, there is a maximal length to 'tell' messages. Sorry, this should be
 documented in the reference.

 It is the system-dependent constant PIPE_BUF, which used to be 512 bytes
 on old Unixes, and is now e.g. 4096 bytes on Linux, or 5120 bytes on
 SunOS (I just see, FreeBSD still seems to be 512 bytes).

 This is the size of the buffer in the kernel, and is the maximal amount
 of data that can be sent atomically.

 Atomically is important here, because otherwise processes might block
 when reading from the pipe(s).


 1.) Use some other mechanism or change tell to allow for larger payloads.

 Difficult for the above reason.


 2.) Work around the issue, maybe something can be done with the fact
 that the protocol seems to allow for multiple frames to constitute a
 single payload (don't know if the browsers support this behaviour at

 Something like that sounds better.


 BTW, 'tell' is used by 'commit' internally. Here we have no inherent
 limit, because 'commit' takes care of that. And blocking is not an
 issue, because other processes wait anyway for synchronization.

 ♪♫ Alex

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


Re: Sample code showing 'eval' and 'run' with binding environment

2014-10-24 Thread Henrik Sarvell
Simple example:
http://www.prodevtips.com/2008/08/13/explicit-scope-resolution-in-pico-lisp/

On Thu, Oct 23, 2014 at 4:14 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Jon,

 To better understand the purpose with a binding environment offset
 when using the functions 'eval' and 'run', I think it would be useful to
 see some sample code. Maybe it should even be included right there in
 the ref. docs on these two functions?

 True. But it is not so easy to come up with simple examples.

 I added some to the references. Hope it helps.

 BTW, many functions in lib/xhtml.l make use of binding environment
 offsets.

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


Re: Documentation again

2014-08-13 Thread Henrik Sarvell
Alabhya you might want to check out this:
http://www.prodevtips.com/2013/10/18/emacs-as-a-multi-mode-web-dev-ide-is-now-possible/

The Projectile and Ido combination is great for finding files, directories
and grepping your files.


On Wed, Aug 13, 2014 at 7:55 PM, Alabhya Singh alab...@yahoo.com wrote:

 Hi Jolitz

 Nice to see Emacs expert enthusiasm here!

 Will definitely give a try to helm. Thanks.

 Sure! Please send the files as
 PM attachment at alab...@yahoo.com

 Will send then back in Orgmode format.

 Alabhya

  --
 * From: * Thorsten Jolitz tjol...@gmail.com;
 * To: * picolisp@software-lab.de;
 * Subject: * Re: Documentation again
 * Sent: * Tue, Aug 12, 2014 1:22:08 PM

   Alabhya Singh alab...@yahoo.com writes:

   Thanks a lot! Thorsten Jolitz for detailed informative help.

 As an Org-mode fan I would really like to have these docs in Org-mode,
 would make everything easier, but then you need to prepare the export to
 LaTeX such that the outcome looks as professional as the Springer
 LaTeX templates I used for the books. Its possible, but likely not easy
 and time consuming.

 I do have both books as .txt files (as the only two files in a directory)
 on my
 machine, for searching them in parrallel with

 ,[ C-h f helm-do-grep RET ]
 | helm-do-grep is an interactive autoloaded Lisp function in
 | `helm-grep.el'.
 |
 | It is bound to C-x c M-g s, menu-bar tools Helm Tools Grep.
 |
 | (helm-do-grep)
 |
 | Preconfigured helm for grep.
 | Contrarily to Emacs `grep', no default directory is given, but
 | the full path of candidates in ONLY.
 | That allow to grep different files not only in `default-directory' but
 anywhere
 | by marking them (C-SPACE). If one or more directory is selected
 | grep will search in all files of these directories.
 | You can also use wildcard in the base name of candidate.
 | If a prefix arg is given use the -r option of grep (recurse).
 | The prefix arg can be passed before or after start file selection.
 | See also `helm-do-grep-1'.
 `

 Its very convenient to be able to simply copy found code/text from an
 Emacs buffer then. Don't remember how I converted the docs, but I could
 send them as PM attachment if you send me a private email address.

  --
  From: Thorsten Jolitz
  tjol...@gmail.com;
  To: picolisp@software-lab.de;
  Subject: Re: Documentation again
  Sent: Tue, Aug 12, 2014 9:33:36 AM
 
 
   Alabhya Singh alab...@yahoo.com
   writes:
 
I support Henrik and even would request the docs to be available in
universal and simple formats:
1. Text
 
   The .tex sources are just text files, with LaTeX markup though. But
   there are tools like
 
   ,
   | pandoc
   | latex2html
   | latex2rtf
   | tex2man
   | [...]
   `
 
   to convert them.
 
2. Orgmode
 
   pandoc does latex-org
 
3. HTML
 
   try
   latex2html
   or pandoc again? latex to html should be pretty advanced there
   or export to org, improve the org file (easy) and the export to html
 
   These converters are all less than perfect, but they might give you
   valid docs in other formats, that can then be improved with a really
   good editor like Emacs or Vim (or with a PicoLisp program of course).
 
   
   -
   -
From: Henrik Sarvell
hsarv...@gmail.com;
To: picolisp@software-labde;
Subject: Re: Documentation again
Sent: Tue, Aug 12, 2014 5:16:39 AM
   
   
I noted that it's not possible to download PDFs at all from Scribd
anymore without paying $9. What about making them downloadable from
picolisp.com?
   
On Tue, Aug 12, 2014 at 1:57 AM, Thorsten Jolitz
tjol...@gmail.com wrote:
 Christophe Gragnic
 christophegrag...@gmail.com
writes:

 Le 7 août 2014 14:11, Jon Kleiser
 jon.klei...@fsat.no a écrit :

 I use the frame-based solution for doc lookup (index.html by
me),
 here http://www.software-lab.de/doc/,

 I realised only a few months ago that these pages were Jon's
   work
(or
 in part?). Thanks for this. I'd be curious to have an historical
point
 of view concerning the doc.

 Now a question then a suggestion.

 Is there a good reason to have separate pages? I understand that
only
 one page would be huge but I'd find it more convenient.

 Would it be interesting to have the ref in a format like
   Markdown
and
 generate a single or several pages, in html or pdf?
 BTW I just noticed in the doc for (usec) that there was a typo
and
 that I don't find it very clear:
 http://software-lab.de/doc/refU.html#usec

 Are you aware of

 http://www.scribd.com/doc/103732688/PicoLisp-Works
 https://github.com/tj64/picolisp-works

 http://www.scribd.com/doc/103733857/PicoLisp-by-Example
 https://github.com/tj64/picolisp

Re: Documentation again

2014-08-12 Thread Henrik Sarvell
Hi Alabahya, they mostly are available in HTML on picolisp.com itself or
linked to from picolisp.com.

My thinking is more for offline viewing.


On Tue, Aug 12, 2014 at 1:02 PM, Alabhya Singh alab...@yahoo.com wrote:

 I support Henrik and even would request the docs to be available in
 universal and simple formats:
 1. Text
 2. Orgmode
 3. HTML

  --
 * From: * Henrik Sarvell hsarv...@gmail.com;
 * To: * picolisp@software-lab.de;
 * Subject: * Re: Documentation again
 * Sent: * Tue, Aug 12, 2014 5:16:39 AM

   I noted that it's not possible to download PDFs at all from Scribd
 anymore without paying $9. What about making them downloadable from
 picolisp.com?

 On Tue, Aug 12, 2014 at 1:57 AM, Thorsten Jolitz tjol...@gmail.com
 wrote:
  Christophe Gragnic
  christophegrag...@gmail.com writes:
 
  Le 7 août 2014 14:11, Jon Kleiser
  jon.klei...@fsat.no a écrit :
 
  I use the frame-based solution for doc lookup (index.html by me),
  here http://www.software-lab.de/doc/,
 
  I realised only a few months ago that these pages were Jon's work (or
  in part?). Thanks for this. I'd be curious to have an historical point
  of view concerning the doc.
 
  Now a question then a suggestion.
 
  Is there a good reason to have separate pages? I understand that only
  one page would be huge but I'd find it more convenient.
 
  Would it be interesting to have the ref in a format like Markdown and
  generate a single or several pages, in html or pdf?
  BTW I just noticed in the doc for (usec) that there was a typo and
  that I don't find it very clear:
  http://software-lab.de/doc/refU.html#usec
 
  Are you aware of
 
  http://www.scribd.com/doc/103732688/PicoLisp-Works
  https://github.com/tj64/picolisp-works
 
  http://www.scribd.com/doc/103733857/PicoLisp-by-Example
  https://github.com/tj64/picolisp-by-example
 
  ?
 
  --
  cheers,
  Thorsten
 
  --
  UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

 --
 UNSUBSCRIBE: mailto:picolisp@software-labde?subject=Unsubscribe



Re: Documentation again

2014-08-11 Thread Henrik Sarvell
I noted that it's not possible to download PDFs at all from Scribd
anymore without paying $9. What about making them downloadable from
picolisp.com?

On Tue, Aug 12, 2014 at 1:57 AM, Thorsten Jolitz tjol...@gmail.com wrote:
 Christophe Gragnic
 christophegrag...@gmail.com writes:

 Le 7 août 2014 14:11, Jon Kleiser
 jon.klei...@fsat.no a écrit :

 I use the frame-based solution for doc lookup (index.html by me),
 here http://www.software-lab.de/doc/,

 I realised only a few months ago that these pages were Jon's work (or
 in part?). Thanks for this. I'd be curious to have an historical point
 of view concerning the doc.

 Now a question then a suggestion.

 Is there a good reason to have separate pages? I understand that only
 one page would be huge but I'd find it more convenient.

 Would it be interesting to have the ref in a format like Markdown and
 generate a single or several pages, in html or pdf?
 BTW I just noticed in the doc for (usec) that there was a typo and
 that I don't find it very clear:
 http://software-lab.de/doc/refU.html#usec

 Are you aware of

 http://www.scribd.com/doc/103732688/PicoLisp-Works
 https://github.com/tj64/picolisp-works

 http://www.scribd.com/doc/103733857/PicoLisp-by-Example
 https://github.com/tj64/picolisp-by-example

 ?

 --
 cheers,
 Thorsten

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


Re: Solved: Tell mechanism issue (perhaps OT)

2014-08-07 Thread Henrik Sarvell
Hi Jorge, how much RAM does it have, is it a 64bit machine?

I have checked the number Alex mentioned on some of our servers, all
running Ubuntu 12.04, servers below 64GB RAM have that number set to
32768 per default, machines with 128GB got 98304.

On Thu, Aug 7, 2014 at 12:49 PM, Jorge Acereda Maciá jacer...@gmail.com wrote:
 I’m getting pids well above 64k on my laptop (OS X).

 On 06 Aug 2014, at 22:33, Alexander Burger a...@software-lab.de wrote:

 Hi Randall,

 I believe that modern Linux and FreeBSD implementations use 32 bit
 ints for the pid_t.

 Right.

 There will never be that many processes on a 32 bit
 OS, but since they just go forward until they wrap, getting a pid bigger
 than 16 bits is probably even to be expected.

 However, they don't plainly wrap. There is a system limit in the kernel,
 controlled via /proc/sys/kernel/pid_max.

 Even on 64-bit machines (where pid_t is also an 'int', i.e. a 64-bit
 number), PIDs don't get up to such huge numbers.

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

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


Re: Solved: Tell mechanism issue (perhaps OT)

2014-08-07 Thread Henrik Sarvell
Jorge, forget that question, I just got told that osx only have the
32bit version.

On Thu, Aug 7, 2014 at 1:09 PM, Henrik Sarvell hsarv...@gmail.com wrote:
 Hi Jorge, how much RAM does it have, is it a 64bit machine?

 I have checked the number Alex mentioned on some of our servers, all
 running Ubuntu 12.04, servers below 64GB RAM have that number set to
 32768 per default, machines with 128GB got 98304.

 On Thu, Aug 7, 2014 at 12:49 PM, Jorge Acereda Maciá jacereda@gmailcom 
 wrote:
 I’m getting pids well above 64k on my laptop (OS X).

 On 06 Aug 2014, at 22:33, Alexander Burger a...@software-lab.de wrote:

 Hi Randall,

 I believe that modern Linux and FreeBSD implementations use 32 bit
 ints for the pid_t.

 Right.

 There will never be that many processes on a 32 bit
 OS, but since they just go forward until they wrap, getting a pid bigger
 than 16 bits is probably even to be expected.

 However, they don't plainly wrap. There is a system limit in the kernel,
 controlled via /proc/sys/kernel/pid_max.

 Even on 64-bit machines (where pid_t is also an 'int', i.e. a 64-bit
 number), PIDs don't get up to such huge numbers.

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

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


Re: Implementation Education

2014-08-07 Thread Henrik Sarvell
Hi Alabhya, if I were you I would learn enough C to understand the pil32
source and then go through it.


On Thu, Aug 7, 2014 at 4:00 PM, Alabhya Singh alab...@yahoo.com wrote:

 To be able to use a language with utmost confidence one should be able to
 understand its implementation so much so as to be able to implement it and
 maintain it.

 This I am saying from my experience in maintaining my Porteus Linux system.
 PicoLisp matches Porteus in many ways, minimalist, easy to maintain, speed
 etc.

 PicoLisp philosophy of minimal orthogonal design makes it ideal for this
 down to bare metal approach.

 However I am just a novice lisp programmer who would love to invest
 significant effort into learning through using picoLisp.

 I shall be grateful if Alexander and/or other senior experienced people be
 kind enough to outline various components of implementing picoLisp.

 Such as: knowledge level of lisp, assembly and C (reference books, links
 etc).

 Kindly indicate steps to start learning how to implement and maintain
 picoLisp.





Re: Implementation Education

2014-08-07 Thread Henrik Sarvell
Perhaps not simpler but my thinking is that it's probably easier to find
resources on C plus getting to know C better might have higher utility than
assembly.


On Thu, Aug 7, 2014 at 4:44 PM, Alabhya Singh alab...@yahoo.com wrote:

 Thanks Henrik.

 May be because pil32 and C are simpler than pil64 and assembly
 respectively.

  --
 * From: * Henrik Sarvell hsarv...@gmail.com;
 * To: * picolisp@software-lab.de;
 * Subject: * Re: Implementation Education
 * Sent: * Thu, Aug 7, 2014 9:31:10 AM

   Hi Alabhya, if I were you I would learn enough C to understand the
 pil32 source and then go through it.


 On Thu, Aug 7, 2014 at 4:00 PM, Alabhya Singh alab...@yahoo.com wrote:

 To be able to use a language with utmost confidence one should be able to
 understand its implementation so much so as to be able to implement it and
 maintain it.

 This I am saying from my experience in maintaining my Porteus Linux
 system.
 PicoLisp matches Porteus in many ways, minimalist, easy to maintain,
 speed etc.

 PicoLisp philosophy of minimal orthogonal design makes it ideal for this
 down to bare metal approach.

 However I am just a novice lisp programmer who would love to invest
 significant effort into learning through using picoLisp.

 I shall be grateful if Alexander and/or other senior experienced people
 be kind enough to outline various components of implementing picoLisp.

 Such as: knowledge level of lisp, assembly and C (reference books, links
 etc).

 Kindly indicate steps to start learning how to implement and maintain
 picoLisp.






Re: Frameset errors in doc/index.html

2014-08-07 Thread Henrik Sarvell
I see no JS errors in the console of FF 22 and Chrome 33.

On Thu, Aug 7, 2014 at 6:28 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Jon,

 I use the frame-based solution for doc lookup (index.html by me)

 Me too :)


 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Frameset//EN
   http://www.w3.org/TR/html4/frameset.dtd”

 Thanks! I've incorporated it into the release.
 ♪♫ Alex
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Solved: Tell mechanism issue (perhaps OT)

2014-08-07 Thread Henrik Sarvell
The fix has been running now for roughly 24 hours with PIDs both below
and above 16bit with roughly 2-30 requests per second depending on the
hour, works flawlessly.

One reset from 98304 to 300 has already happened without issues.

Using pil64.


On Thu, Aug 7, 2014 at 2:19 PM, Alexander Burger a...@software-lab.de wrote:
 Hi all,

 On Thu, Aug 07, 2014 at 09:00:21AM +0200, Alexander Burger wrote:
 Fixed pil32 too. I hope I didn't break anything. Tests are welcome!

 For the records:

 The handling of PIDs in both the 32-bit and the 64-bit versions of
 PicoLisp itself was never a problem. They are handled in full 'pid_t'
 size.

 The problem was the internal IPC protocol used by the 'tell' function,
 when an (optional) PID is passed for the addressee of the message. Here,
 a field of only 16 bits was used to store the PID. This is fixed now in
 pil32 and pil64.

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


Re: Tell mechanism issue (perhaps OT)

2014-08-04 Thread Henrik Sarvell
To sum up some IRC communication, it's not the parent id that gets
told, it's a sibling PID.

I will be back with more when the problem arises again.

On Mon, Aug 4, 2014 at 12:30 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Henrik,

 When using the new websocket server (
 http://picolisp.com/wiki/?Websockets ) in production (tell ParentPid
 'func bla bla) stops working after a while.

 I haven't checked the details, but let me note the 'tell'ing to the
 parent process is not possible.

 The reference of 'tell' says

Send .. to .. all children of the current process, and all other
children of the parent process

 The parent process is the one thay relays all messages between the
 processes. It cannot be the addressee of a messages.

 Therefore, as a general rule, the parent should never be assigned any
 application tasks (especially not database manipulations, as these are
 also synchronized via the 'tell' mechanisms). It should be as
 lightweight as possible, just waiting for events and delegating work to
 the children.


 For messages to the parent, you might consider the @lib/boss.l
 mechanism (I know you have used that in the past), calling 'boss' in the
 children and 'hear' in the parent.


 So this is to be expected:

 parent process has problems preventing it from responding to tell, so


 But still, however, I have no explanation for

 I've had the server running on a test machine for weeks now without
 issues whereas it fails in production after 1-2 days so it has

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


Tell mechanism issue (perhaps OT)

2014-08-03 Thread Henrik Sarvell
This question might be OT or self-evident for someone with better
basic understanding of Linux than me.

When using the new websocket server (
http://picolisp.com/wiki/?Websockets ) in production (tell ParentPid
'func bla bla) stops working after a while.

Here comes the weird part, the most probable cause would be that the
parent process has problems preventing it from responding to tell, so
restarting the server should fix the issue.

It doesn't, only rebooting the machine makes tell work again.

I've had the server running on a test machine for weeks now without
issues whereas it fails in production after 1-2 days so it has
something to do with the higher activity on the production box but I
can't understand what the cause might be.
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-15 Thread Henrik Sarvell
FWIW, in my case I fall back to polling every 10s in case websockets
are not supported. However, as soon as IE9 penetration drops to an
insignificant level I will stop with fallbacks.



On Tue, Jul 15, 2014 at 7:11 PM,  andr...@itship.ch wrote:
 Seems like we have a similar goal, Amaury! Cool :)

 On Mon, Jul 14, 2014 at 03:52:42AM -0700, Amaury Hernández Águila wrote:
 Yeah that would be nice. So, isn't that a good reason to have websockets
 in
 PocoLisp?

 I would not say so. In a video game you have so much continuous
 communication going on (most notably the stream of image frames), that
 you don't need an extra channel.
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


 Online games don't work by feeding single frames to clients. There are now
 a few companies trying to get this alive - like video streaming for games
 - but this not working fluently as the amount of data to transfer when
 rendering images on the server is just too big to have a reasonable
 latency for real-time-games (in opposite to turn based games).

 The continuous communication in a online game is chat and game logic
 messages - user input going up to the server, and results of that inputs
 together with results of behaviour from other agents going down to client

Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Henrik Sarvell
Hi Alex, doesn't all that polling you're doing introduce a lot of
unnecessary requests to the server.

There can be up to 200 persons logged in at the same time at the site
where I'm using websockets now, that would be 100 HTTP POSTS per
second with full HTTP headers etc just to check for notifications that
perhaps 1 or 2 of them would get per 10 seconds.

See figure 3 here: http://www.websocket.org/quantum.html



On Mon, Jul 14, 2014 at 2:44 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Henrik,

 first of all, thank you for the article and the good work!

 However, I must say that I have doubts about the benefits of WebSockets
 in general. I cannot see that they are worth the overhead.


 They introduce a complicated machinery, which is not just a simple
 protocol extension, but a fundamental change in the HTTP transaction
 principles. As that, it violates the PicoLisp philosophy of minimizing
 the number of concepts.

 Second, they require a browser which can handle them. This excludes, for
 example, text browsers like 'w3m'.

 Third, I'm still waiting for the killer-application which really needs
 them. All scenarios I have seen so far can be handled with the standard
 PicoLisp framework much more easily - without explicit maintenance tasks
 lile clearing out disconnected clients and sending a ping ... to keep
 the connection alive. All this is already done automatically.


 To keep with the typical realtime chat, a minimal setup could be:

 
 #!/usr/bin/pil

 (load @lib/http.l @lib/xhtml.l @lib/form.l)

 (de chat ()
(app)
(action
   (html 0 Chat @lib.css NIL
  (form NIL
 (gui 'log '(+FileField) chat.log 60 20)
 (--)
 (gui 'msg '(+TextField) 60)
 (gui '(+Click +Auto +Button) 2000 'This 2000 Chat
'(when (val (: home msg))
   (out +chat.log (prinl @))
   (clr (: home msg)) ) ) ) ) ) )

 (server 8080 !chat)
 (wait)
 

 Put this into a file called chat, set it to executable, and start it
 as:

$ ./chat

 Then point some browser windows to http://localhost:8080;. Everything
 typed into the 'msg' text field (and even in the 'log' field above it)
 appears in all other connected clients after maximally 2 seconds.

 Note that also text browsers like w3m can be used. Just the automatic
 firing of the button won't happen without JavaScript, so the user must
 press the Chat button whenever he wants an update. Also note that due
 to the same-origin-policy of JavaScrpt (repeatedly discussed here) the
 Chat buttun must be pressed in the beginning once, unless - as usually
 recommended - 'httpGate' is running and the client connected directly to
 http://localhost;.


 Other features like a notification system can be implemented even
 simpler. You could, for example, clone the existing 'ping' and 'ping'
 functions in @lib/xhtml.l and extend them to carry a payload.

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


Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Henrik Sarvell
44KB / second is far from insignificant IMO, it works out to 0.35
Mbit/s if I'm not mistaken, we're paying 20 EUR per month per 1Mbit at
our current co-location. Well worth spending a couple of days to avoid
permanently.

Plus, the goal is to have much much more people logged in in the future.

On Mon, Jul 14, 2014 at 4:52 PM, Alexander Burger a...@software-lab.de wrote:
 On Mon, Jul 14, 2014 at 11:41:08AM +0200, Alexander Burger wrote:
 Not such a big problem. If I measure the described chat client, pinging
 every 2 seconds, I get 335 Bytes per second on the average. This amounts
 to 65 kB per second for 200 clients. Not a big problem today. Typically

 Oops, no! It is even less than that.

 The size I wrote above includes log information like time stamps and
 process IDs. Without them, there are only 218 Bytes per second, giving
 44 KB per second.
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Doubts about the benefits of WebSockets

2014-07-14 Thread Henrik Sarvell
Yes but that's a residential subscription, before we moved to
co-location we used fasthosts.co.uk (highly recommended if you don't
do the kind of realtime stuff I do at work).

With fasthosts you get unlimited speed and transfers but when you do
what we do you quickly realize that it doesn't work good because you
have no control over how your boxes are spaced out in the facility. If
some other customer is transferring massive amounts of data between
one of their boxes the quality of your LAN connection could start
suffering. At one point another customer of theirs got attacked by
some kind of denial of service attack which affected us too since it's
all shared.

In the co-lo where we are now we rent space, a whole rack actually, so
our machines are next to each other served by our own switches. This
has resulted in zero network related outages as opposed to the
situation at fasthosts.

To the co-location facility there are 3 geographically separated
uplinks which we buy dedicated space on, ie we have unlimited amount
of transfer per month of course but we have a roof on how much we can
transfer per second (up and down), this roof can be raised by 20 EUR
per Mbit/s per month. We don't share this with anyone else so the
speed is 100% guaranteed, if we don't utilize it that space is not
used, the actions of other customers in the co-location facility can't
affect us as they are also similarly limited in how much they use.

This is working remarkably well, we're not experiencing any network
related issues at all anymore. But it costs...





On Tue, Jul 15, 2014 at 2:00 AM, Tomas Hlavaty t...@logand.com wrote:
 Hi Henrik,

 44KB / second is far from insignificant IMO, it works out to 0.35
 Mbit/s if I'm not mistaken, we're paying 20 EUR per month per 1Mbit at
 our current co-location. Well worth spending a couple of days to avoid
 permanently.

 wow, 20 EUR per 1Mbit?  160 EUR per 1MByte?  In 2014?  I can't believe
 that.  My home connection costs 24 EUR a month without trafic
 restrictions iirc and is much faster than that:-)

 Cheers,

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


Re: Websockets

2014-07-13 Thread Henrik Sarvell
Hi Andreas.

I don't put httpGate behind Apache since I don't need to use port 443,
in any case without that websocket proxy module I'm not sure it would
even be possible.

Yes, making those two numbers configurable is probably a good idea and
trivial to implement, will fix that asap.


On Sun, Jul 13, 2014 at 10:00 PM,  andr...@itship.ch wrote:
 Hi Henrik

 Thank you for publishing your work and the nice write up!
 I will definitively  study it in detail and probably reuse it at some
 point in the future.

 About 1.) and 2.): I think this is highly depended on the actual use case,
 and has to be configured individually for actual applications (e.g. when
 the usual message interval is high, ping is probably not necessary).
 Good you pointed this configurations out!

 One question: You write you use this in a LAMP environment, am I correct
 in assuming clients connect directly to httpGate and then pl-web?
 Or do you put httpGate behind Apache, and if so, why?

 Thanks :)

 The past few days I've been working on websockets and the write up is
 here: http://picolisp.com/wiki/?Websockets

 There are two settings that could be discussed right away on this mailing
 list:

 1.) The appropriateness of clearing out disconnected clients from the
 tag and id lists every 5 seconds, maybe it should be higher, maybe
 lower.

 2.) The appropriateness of sending a ping from each client process to
 each client every 10 seconds to keep the connection alive, it could
 probably be higher.

 Finally note that I'm not using the words subscribe, publish or
 channel in the post (or the code) is that I don't want to confuse
 what I've done with WAMP: http://wamp.ws/ since it's not an
 implementation of that sub-protocol.

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




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


Websockets

2014-07-12 Thread Henrik Sarvell
The past few days I've been working on websockets and the write up is
here: http://picolisp.com/wiki/?Websockets

There are two settings that could be discussed right away on this mailing list:

1.) The appropriateness of clearing out disconnected clients from the
tag and id lists every 5 seconds, maybe it should be higher, maybe
lower.

2.) The appropriateness of sending a ping from each client process to
each client every 10 seconds to keep the connection alive, it could
probably be higher.

Finally note that I'm not using the words subscribe, publish or
channel in the post (or the code) is that I don't want to confuse
what I've done with WAMP: http://wamp.ws/ since it's not an
implementation of that sub-protocol.

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


Re: nooby question re lists and quoting

2014-04-17 Thread Henrik Sarvell
Hi Simon, if we take the classic ps aux | grep X

Obviously you can just input one function into the next like this: (println
(excmd~exe (excmd~script 'ps T 'aux) T 'grep 'bash))

Not so elegant, so I added this to cmd.l:

(de chain @
   (let Str (in (next) (till NIL T))
  (while (next)
 (setq Str (pipe (out @ (prin Str)) (till NIL T ) )

So you can do like this: (println (excmd~chain '(ps aux) '(grep bash)))

But actually being able to do something like this might be more useful:

(println (excmd~chain
'(ps aux)
'((L) (pack L hijacked with a bash^Jand another line with a
bash))
'(grep bash)
'((L) (mapcar pack (split L ^J))) ) )

So I updated the above function to look like this:

(de chain @
   (let Str (in (next) (till))
  (while
 (let? L (next)
(setq Str
   (if (or (sym? L) (lst? (car L)))
  (L Str)
  (pipe (out L (prin (if (str? Str) Str (pack Str
(till)) ) ) ) )
  Str ) )

More to your likening?




On Thu, Apr 17, 2014 at 9:50 PM, Simon Luetzelschwab simo...@gmail.comwrote:

 Thanks for the response Mansur and Henrik - much appreciated.

 Mansur - Great, this looks much better!

 Henrik - I have been looking ath the articles on ProDevTips and some of
 the libs on bitbucket - very helpful as well.

 What I'm really trying to do is have an easy way to invoke arbitrary shell
 commands that may be piped, process the result in pico and maybe use that
 as the input for another command.

 I haven't found a generic example yet that doesn't specify the command
 specifically that allows arbitrary piping and still gives you access to
 intermediary results.

 Feel free to point me to any additional examples that go beyond calling
 one hardcoded command.

 Thanks again and I'm sure I'll be back with more questions!

 Best,
 Simon


 On Wed Apr 16 2014 at 10:02:09 PM, Henrik Sarvell hsarv...@gmail.com
 wrote:

 Hi Simon, this is similar to stuff in my own system command helper
 script, I use it a lot:
 https://bitbucket.org/hsarvell/ext/src/tip/cmd.l?at=default

 It might give you some ideas.

 On Thu, Apr 17, 2014 at 10:13 AM,   wrote:
  Hi, Simon,
 
  you can use apply here:
 
  (de exe2 (X)
 (apply 'call X) )
 
  because call needs multiple arguments, but not one list.
 
  Best regards,
  Mansur Mamkin
 
  17.04.2014 7:17, Simon Luetzelschwab пишет:
 
  Hi,
 
  PicoLisp is my first LISP dialect and I'm trying to move some of the
  things I do on the command line to PicoLisp's REPL and scripts
 
  I'm playing around with pipes, in, out and call and have a basic
 question:
 
  If I have the following fun -
 
  (de exe (X)
  (eval (cons 'call X)) )
 
  I can call it as follows -
 
  (exe '(ls -l))
 
  However, if I've defined it as -
 
  (de exe2 (X)
  (call X) )
 
  I can't figure out how to call exe2.
 
  (exe2 '(ls -l))
  ls-l: Can't exec
  - NIL
 
  I'm pretty sure I shouldn't be using eval for such a case, but can't
  figure it out.
 
  Any insight much appreciated.
 
  Best,
  Simon
 
  PS: I checked the reference, online docs and Henrik's Ext / cmd.l lib
 
  --
  UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subjectUnsubscribe




Re: nooby question re lists and quoting

2014-04-16 Thread Henrik Sarvell
Hi Simon, this is similar to stuff in my own system command helper
script, I use it a lot:
https://bitbucket.org/hsarvell/ext/src/tip/cmd.l?at=default

It might give you some ideas.

On Thu, Apr 17, 2014 at 10:13 AM,   wrote:
 Hi, Simon,

 you can use apply here:

 (de exe2 (X)
(apply 'call X) )

 because call needs multiple arguments, but not one list.

 Best regards,
 Mansur Mamkin

 17.04.2014 7:17, Simon Luetzelschwab пишет:

 Hi,

 PicoLisp is my first LISP dialect and I'm trying to move some of the
 things I do on the command line to PicoLisp's REPL and scripts.

 I'm playing around with pipes, in, out and call and have a basic question:

 If I have the following fun -

 (de exe (X)
 (eval (cons 'call X)) )

 I can call it as follows -

 (exe '(ls -l))

 However, if I've defined it as -

 (de exe2 (X)
 (call X) )

 I can't figure out how to call exe2.

 (exe2 '(ls -l))
 ls-l: Can't exec
 - NIL

 I'm pretty sure I shouldn't be using eval for such a case, but can't
 figure it out.

 Any insight much appreciated.

 Best,
 Simon

 PS: I checked the reference, online docs and Henrik's Ext / cmd.l lib

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


Re: Would a logging framework make sense for PicoLisp

2014-04-12 Thread Henrik Sarvell
I'm glad they helped you.

Just fixed a bug or two, I had to Google to find out how to always display
the newest version on Bitbucket so finally, here is the link:
https://bitbucket.org/hsarvell/ext/src/tip/log.l?at=default

Apparently one has to replace the revision hash with tip.



On Sat, Apr 12, 2014 at 3:33 AM, andr...@itship.ch wrote:

 Hi guys

  Hi Andreas, can I put this in my ext lib:
  https://bitbucket.org/hsarvell/ext ?
 
  I will of course keep the head with your email and info etc

 Yes surely, I feel honored. Thank you for asking!
 By the way, let me thank you for your database tutorials on your blog,
 they helped a lot in the beginning.

  It seems that the earlier raw link was to that specific revision, this is
  better I hope:
 
 https://bitbucket.org/hsarvell/ext/src/0544acf09a6c162f685f28a2e8f2bef8eba23058/log.l?at=default

 Nice, thanks for the nice namespace example. Will introduce namespaces to
 my code now. Side question: Can namespaces be nested? e.g.
 lib~sublib~symbol?

  Sorry Jakob, I should have been more clear, derivative work with enough
  transformativeness is fair use:
  http://en.wikipedia.org/wiki/Transformativeness
 
  It seems that the earlier raw link was to that specific revision, this is
  better I hope:
 
 https://bitbucket.org/hsarvell/ext/src/0544acf09a6c162f685f28a2e8f2bef8eba23058/log.l?at=default
 
 
 
  On Sat, Apr 12, 2014 at 12:48 AM, Jakob Eriksson
  ja...@aurorasystems.euwrote:
 
  If it is derivative, you should ask.
 
  On April 11, 2014 7:07:25 PM CEST, Henrik Sarvell hsarv...@gmail.com
  wrote:
 
  I feel like I have changed the original now to such an extent that I
  don't have to ask anymore :-) It feels like a derivative work.
 
  However, attribution is kept in the source:
 
 https://bitbucket.org/hsarvell/ext/raw/b2516583e54a97c0e903dcb5b63b0b3cb8c1934a/log.l
 
  And here: https://bitbucket.org/hsarvell/ext
 
  Only difference in behaviour is that if you do for instance (setq
  *LogOn
  T) results will be unpredicable, it needs to be set to NIL or one of
  the
  four values, for instance (setq *LogOn 'debug).
 
  Enjoy!
 
 
 
  On Fri, Apr 11, 2014 at 9:28 PM, Henrik Sarvell
  hsarv...@gmail.comwrote:
 
  Hi Andreas, can I put this in my ext lib:
  https://bitbucket.org/hsarvell/ext ?
 
  I will of course keep the head with your email and info etc.
 
 
 
 
  On Mon, Mar 10, 2014 at 6:06 PM, Thorsten Jolitz
  tjol...@gmail.comwrote:
 
  andr...@itship.ch writes:
 
  Hi Andreas,
 
   I'm not sure if I understand you correctly.
   You can use (log) in different ways, e.g.:
   (log just a message)
   (log 'debug variable x is x)
   (log 'warn folder size is reaching 1GB)
   (log 'error a fatal error occured)
  
   If (on *LogOn), all messages get printed.
   If (setq *LogOn 'warn), only warn and error messages (the 2 at
  bottom)
   will be printed.
   If (setq *LogOn 'error), only the last message will be printed.
 
  ok, I see, so its the programmers responsability to put 'warn and
  'error
  level statements in places that are only reached under some error
  condition and nowhere else.
 
   So far this system only handles messages which you explicitly send
   yourself with (log Type any ...). Error ouput from pil isn't
  getting
   handled, as I don't know how I could do that. Pil error messages
  can
  be
   redirected to a file with (err), but I don't see a way to get it
   redirected to a function...
  
   Does this answer your question?
 
  Yes, thanks!
 
   Thorsten Jolitz tjol...@gmail.com
   writes:
  
   after testing a bit more I have one question:
  
   It seems the levels 'warning and 'error unconditionally print
  their
   messages when *LogOn is set to them, but from my understanding
  these
   levels would eventually be turned-on in production code and thus
   should only print something when something goes wrong in the
  program
   execution.
  
   Would it be possible to only log messages from catched error with
  level
   'warning and try to log some system information when there is a
  real
   uncatched error with log-level 'error? So that level 'warning
  would
   become the default level for production code and nothing is
  printed
  as
   long as the program runs smoothly?
  
   --
   cheers,
   Thorsten
  
   --
   UNSUBSCRIBE:
   mailto:picolisp@software-lab.de?subject=Unsubscribe
  
  
  
  
 
  --
  cheers,
  Thorsten
 
  --
  UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
 
 
 
 
  --
  Sent from my Android device with K-9 Mail. Please excuse my brevity.
 
 
 



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



Re: Would a logging framework make sense for PicoLisp

2014-04-11 Thread Henrik Sarvell
Hi Andreas, can I put this in my ext lib: https://bitbucket.org/hsarvell/ext?

I will of course keep the head with your email and info etc.




On Mon, Mar 10, 2014 at 6:06 PM, Thorsten Jolitz tjol...@gmail.com wrote:

 andr...@itship.ch writes:

 Hi Andreas,

  I'm not sure if I understand you correctly.
  You can use (log) in different ways, e.g.:
  (log just a message)
  (log 'debug variable x is x)
  (log 'warn folder size is reaching 1GB)
  (log 'error a fatal error occured)
 
  If (on *LogOn), all messages get printed.
  If (setq *LogOn 'warn), only warn and error messages (the 2 at bottom)
  will be printed.
  If (setq *LogOn 'error), only the last message will be printed.

 ok, I see, so its the programmers responsability to put 'warn and 'error
 level statements in places that are only reached under some error
 condition and nowhere else.

  So far this system only handles messages which you explicitly send
  yourself with (log Type any ...). Error ouput from pil isn't getting
  handled, as I don't know how I could do that. Pil error messages can be
  redirected to a file with (err), but I don't see a way to get it
  redirected to a function...
 
  Does this answer your question?

 Yes, thanks!

  Thorsten Jolitz tjol...@gmail.com
  writes:
 
  after testing a bit more I have one question:
 
  It seems the levels 'warning and 'error unconditionally print their
  messages when *LogOn is set to them, but from my understanding these
  levels would eventually be turned-on in production code and thus
  should only print something when something goes wrong in the program
  execution.
 
  Would it be possible to only log messages from catched error with level
  'warning and try to log some system information when there is a real
  uncatched error with log-level 'error? So that level 'warning would
  become the default level for production code and nothing is printed as
  long as the program runs smoothly?
 
  --
  cheers,
  Thorsten
 
  --
  UNSUBSCRIBE:
  mailto:picolisp@software-lab.de?subject=Unsubscribe
 
 
 
 

 --
 cheers,
 Thorsten

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



Re: Would a logging framework make sense for PicoLisp

2014-04-11 Thread Henrik Sarvell
I feel like I have changed the original now to such an extent that I don't
have to ask anymore :-) It feels like a derivative work.

However, attribution is kept in the source:
https://bitbucket.org/hsarvell/ext/raw/b2516583e54a97c0e903dcb5b63b0b3cb8c1934a/log.l

And here: https://bitbucket.org/hsarvell/ext

Only difference in behaviour is that if you do for instance (setq *LogOn T)
results will be unpredicable, it needs to be set to NIL or one of the four
values, for instance (setq *LogOn 'debug).

Enjoy!



On Fri, Apr 11, 2014 at 9:28 PM, Henrik Sarvell hsarv...@gmail.com wrote:

 Hi Andreas, can I put this in my ext lib:
 https://bitbucket.org/hsarvell/ext ?

 I will of course keep the head with your email and info etc.




 On Mon, Mar 10, 2014 at 6:06 PM, Thorsten Jolitz tjol...@gmail.comwrote:

 andr...@itship.ch writes:

 Hi Andreas,

  I'm not sure if I understand you correctly.
  You can use (log) in different ways, e.g.:
  (log just a message)
  (log 'debug variable x is x)
  (log 'warn folder size is reaching 1GB)
  (log 'error a fatal error occured)
 
  If (on *LogOn), all messages get printed.
  If (setq *LogOn 'warn), only warn and error messages (the 2 at bottom)
  will be printed.
  If (setq *LogOn 'error), only the last message will be printed.

 ok, I see, so its the programmers responsability to put 'warn and 'error
 level statements in places that are only reached under some error
 condition and nowhere else.

  So far this system only handles messages which you explicitly send
  yourself with (log Type any ...). Error ouput from pil isn't getting
  handled, as I don't know how I could do that. Pil error messages can be
  redirected to a file with (err), but I don't see a way to get it
  redirected to a function...
 
  Does this answer your question?

 Yes, thanks!

  Thorsten Jolitz tjol...@gmail.com
  writes:
 
  after testing a bit more I have one question:
 
  It seems the levels 'warning and 'error unconditionally print their
  messages when *LogOn is set to them, but from my understanding these
  levels would eventually be turned-on in production code and thus
  should only print something when something goes wrong in the program
  execution.
 
  Would it be possible to only log messages from catched error with level
  'warning and try to log some system information when there is a real
  uncatched error with log-level 'error? So that level 'warning would
  become the default level for production code and nothing is printed as
  long as the program runs smoothly?
 
  --
  cheers,
  Thorsten
 
  --
  UNSUBSCRIBE:
  mailto:picolisp@software-lab.de?subject=Unsubscribe
 
 
 
 

 --
 cheers,
 Thorsten

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





Re: Would a logging framework make sense for PicoLisp

2014-04-11 Thread Henrik Sarvell
Sorry Jakob, I should have been more clear, derivative work with enough
transformativeness is fair use:
http://en.wikipedia.org/wiki/Transformativeness

It seems that the earlier raw link was to that specific revision, this is
better I hope:
https://bitbucket.org/hsarvell/ext/src/0544acf09a6c162f685f28a2e8f2bef8eba23058/log.l?at=default



On Sat, Apr 12, 2014 at 12:48 AM, Jakob Eriksson ja...@aurorasystems.euwrote:

 If it is derivative, you should ask.

 On April 11, 2014 7:07:25 PM CEST, Henrik Sarvell hsarv...@gmail.com
 wrote:

 I feel like I have changed the original now to such an extent that I
 don't have to ask anymore :-) It feels like a derivative work.

 However, attribution is kept in the source:
 https://bitbucket.org/hsarvell/ext/raw/b2516583e54a97c0e903dcb5b63b0b3cb8c1934a/log.l

 And here: https://bitbucket.org/hsarvell/ext

 Only difference in behaviour is that if you do for instance (setq *LogOn
 T) results will be unpredicable, it needs to be set to NIL or one of the
 four values, for instance (setq *LogOn 'debug).

 Enjoy!



 On Fri, Apr 11, 2014 at 9:28 PM, Henrik Sarvell hsarv...@gmail.comwrote:

 Hi Andreas, can I put this in my ext lib:
 https://bitbucket.org/hsarvell/ext ?

 I will of course keep the head with your email and info etc.




 On Mon, Mar 10, 2014 at 6:06 PM, Thorsten Jolitz tjol...@gmail.comwrote:

 andr...@itship.ch writes:

 Hi Andreas,

  I'm not sure if I understand you correctly.
  You can use (log) in different ways, e.g.:
  (log just a message)
  (log 'debug variable x is x)
  (log 'warn folder size is reaching 1GB)
  (log 'error a fatal error occured)
 
  If (on *LogOn), all messages get printed.
  If (setq *LogOn 'warn), only warn and error messages (the 2 at bottom)
  will be printed.
  If (setq *LogOn 'error), only the last message will be printed.

 ok, I see, so its the programmers responsability to put 'warn and 'error
 level statements in places that are only reached under some error
 condition and nowhere else.

  So far this system only handles messages which you explicitly send
  yourself with (log Type any ...). Error ouput from pil isn't getting
  handled, as I don't know how I could do that. Pil error messages can
 be
  redirected to a file with (err), but I don't see a way to get it
  redirected to a function...
 
  Does this answer your question?

 Yes, thanks!

  Thorsten Jolitz tjol...@gmail.com
  writes:
 
  after testing a bit more I have one question:
 
  It seems the levels 'warning and 'error unconditionally print their
  messages when *LogOn is set to them, but from my understanding these
  levels would eventually be turned-on in production code and thus
  should only print something when something goes wrong in the program
  execution.
 
  Would it be possible to only log messages from catched error with
 level
  'warning and try to log some system information when there is a real
  uncatched error with log-level 'error? So that level 'warning would
  become the default level for production code and nothing is printed
 as
  long as the program runs smoothly?
 
  --
  cheers,
  Thorsten
 
  --
  UNSUBSCRIBE:
  mailto:picolisp@software-lab.de?subject=Unsubscribe
 
 
 
 

 --
 cheers,
 Thorsten

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




 --
 Sent from my Android device with K-9 Mail. Please excuse my brevity.



  1   2   3   4   >