Re: PicoLisp REPL on Twitter

2022-04-19 Thread Christophe Gragnic
On Tue, Apr 19, 2022 at 4:56 PM Alexander Burger  wrote:
>
> I wanted to do that, but Mr. Twitter did not allow me to install a PicoLisp
> sandbox on his server.

I guess you could still watch for tweets sent to this account and make
it post a reply.
You may not even need to use the API:
https://developer.twitter.com/en/docs/twitter-api
and just parse this page:
https://twitter.com/search?q=(to%3ApicolispRepl)
or any other advanced search:
https://twitter.com/search-advanced


chri

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


Re: wordle

2022-02-13 Thread Christophe Gragnic
Thanks.
For those who don't follow this wonderful channel 3Blue1Brown,
here is a Wordle solver explained:
https://www.youtube.com/watch?v=v68zYyaEmEA

chri

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


Re: Picolisp Outlook

2021-02-21 Thread Christophe Gragnic
Hi!

My personal thoughts below

Le dim. 21 févr. 2021 à 17:57,  a écrit :

> ... where do you see the future of Picolisp in the years to come?
>

People willing to use it will use it. People not aware of it or not wanting
to use it will not use it. That's all.
Alex just made a "coup de maître" reimplementing his language, who is able
to predict his next brilliant move!?

What do you see as the killer feature that could help Picolisp to strive
> and survive?
>

PicoLisp is a language (with a fascinating set of implementations), not a
product.

What do you think is missing in the Picolisp ecosystem?
>

Nothing, or Alex would have implemented it!

Wait. I have an idea I'll send to the list in another message. Nothing
language related, maybe a howto request.


chri

>


Re: Time to say goodbye

2020-05-16 Thread Christophe Gragnic
On Mon, Feb 10, 2020 at 5:06 PM Jon Kleiser  wrote:
>
> Hi Alexander and the rest,

Hi Jon,
Just a big thanks, 3 months later, to you Jon.
You were very helpful and unlocked many possibilities for my project
that used EmuLisp.
Maybe we'll see you at PilCon 2020 that we'll have to organize remotely.

chri

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


Re: Do free Open Source Foundation's Software Stacks fall under US Export Law?

2020-05-06 Thread Christophe Gragnic
On Wed, May 6, 2020 at 3:11 PM John Duncan  wrote:
>
> Just wanted to tell you how much I appreciate your work. I hope you find a 
> blowhard like Guido amusing and not too irritating. I get the impression he’s 
> hardly written a line of code in his life, and that was probably in Java.

Just wanted to tell you how much I appreciate your three sentences above.
A few days ago I wanted to answer Guido and tell him what I thought,
but your protocol is much more interesting.
At least I got that from this story.


chri

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


Re: PilCon 2020

2020-04-28 Thread Christophe Gragnic
On Tue, Apr 28, 2020 at 8:48 AM Jean-Christophe Helary
 wrote:
>
> Definitely. Maybe the day before ? A short rehearsal for all the people who 
> have presentations to see if things work well ?

I was thinking about having much more time before the event.
Like at least a month or two but I don't have the scheduled dates handy.
And we could have nice little chats!


chri

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



Re: PilCon 2020

2020-04-28 Thread Christophe Gragnic
On Tue, Apr 28, 2020 at 7:44 AM Alexander Burger  wrote:
> We used Jitsi a lot during the last weeks. I have tried up to only 5 members 
> so
> far, but performance was good. Beneroth has set up his own server. I don't 
> know
> how well it scales for more members, and what can be done to optimize it.

Hi,

1) I'm very excited to hear about this idea of virtual gathering.
Sorry for those who could have been to a real gathering,
but this will allow me to participate.

2) We could organize a «warm up» as it is done in music festivals

Re: pil21, some progress

2020-02-16 Thread Christophe Gragnic
On Sun, Feb 16, 2020 at 12:12 AM C K Kashyap  wrote:
>
> Thanks Alexa friend of mine recently made a RISC V processor using fpga 
> and it got me intrigued by the whole FPGA thing ...perhaps a picolisp machine 
> may be possible :)

Hi,
Did you know about this?
https://www.mail-archive.com/picolisp@software-lab.de/msg04823.html
Regards.

chri

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


Re: PicoLisp for 9-11 years' kids

2019-04-17 Thread Christophe Gragnic
On Wed, Apr 17, 2019 at 12:18 AM  wrote:
>
> Too bad.  I'm curious now if there was a predecessor to Python as the 
> mandated computer language.  If so, what was it?

Hi,
Say 5% of the high school teachers used only calculators for
programming (yeah, Texas Instr Basic or Casio Basic),
5% used Scratch, 1% already used Python and the rest used Algobox:
http://www.xm1math.net/algobox/

It's not that we were asked to use this predecessor,
but it was $free$ (teachers are not concerned about free (speach) software),
had a great documentation and examples and was in French.


chri

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


Re: PicoLisp for 9-11 years' kids

2019-04-16 Thread Christophe Gragnic
On Sun, Apr 14, 2019 at 8:07 PM cilz  wrote:
>
> I guess it's microAlg which you can find here:
> http://microalg.info/
> I' dont know if there is an english translation of the website which is 
> french.

Hi, very glad that MicroAlg left some memories here and there!
The website, all the keywords, documentation is French only.
MicroAlg is a language directly embedded in PicoLisp (my student had
access to all PicoLisp syms).


On Mon, Apr 15, 2019 at 11:20 AM pd  wrote:
>
> yes, that it is.  A very interesting project specially for education

Thanks for your interest.
The project is now stopped because Python must now be used in high
school in France.
If ever you are in a French speaking env and are interested in
teaching I'd be glad to chat.


On Mon, Apr 15, 2019 at 11:37 AM Nehal  wrote:
>
> Indeed this website is wonderful.

Many thanks! It was quite some hard work for me who is not a full time dev.
Please note that I spent more time on the language itself and the
tooling than on the website!

> However I am looking for something only based in PicoLisp.

Indeed MicroAlg is not what you are looking for.
But let me make some suggestions:
1) Don't underestimate the (natural) language barrier.
Many of my students were glad the language was in French.
But your students may be good enough at reading/writing English.

2) Don't understimate the power of syntax highlighting
(rainbow parens, delimiters and delimited sections, and keywords).
You'll be happy to be able to debug a program in 10ms.

3) Don't underestimate the fun that kids can have in a playground.
You want you students to work with a practical language, with real applications.
This is very nice but may not be really needed at first.
Toy programs with text display, with a turtle, with shapes to draw…
could be enough.

4) Deployment is important too. Try to make it easy.
Thank to Jon Kleiser I was able to make the snippets run in the
browser too, which was a bliss.

Have fun!


chri

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


Re: Survey results

2018-07-17 Thread Christophe Gragnic
Thanks Arie for the good work, that was very informative.
You should be proud of the "go on with the result of the survey" answer.

chri

On Tue, 17 Jul 2018 9:25 pm Alexander Burger  wrote:

> Hi Arie,
>
> > please find all survey results attached. Since a lot of comments were
> given
> > it maybe needs a bit of time to sink in before moving forward.
>
> Wow! Impressive!
>
> —Alex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>


Re: Needing a trick with 'de

2017-10-16 Thread Christophe Gragnic
On Mon, Oct 16, 2017 at 3:25 PM, Alexander Burger  wrote:
> This is just unnecessary overhead, as 'let' is basically 'bind' (or 'use' to 
> be
> more correct) plus 'setq'. And 'X' is bound already by the function call. So 
> why
> waste time and (stack)space?

Because I thought that setq would store a value in the parameter var
"more permanently".
Something like:

  : (foo (need 3))
   (need 3)
   -> 3
  : X
  -> (need 3)  # what I expected

 I thought using a let was necessary to free X afterwards, but even
using setq, X was freed:

  : (foo (need 3))
   (need 3)
   -> 3
  : X
  -> NIL  # what really occured

My question: which mechanism frees X of the value it was setq-ed?


chri

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


Re: Needing a trick with 'de

2017-10-15 Thread Christophe Gragnic
On Sat, Oct 14, 2017 at 7:48 AM, Alexander Burger  wrote:
> You are close :)

Hi Alex,
Thanks, I'm making some progress at last!
A personal lesson:
when meta-programming, I should make more use of pp.

> I would do this:
>
>(de decar Lst
>   (def (++ Lst)
>  (let Var (++ Lst)
> (cons
>Var
>(list 'setq Var (list 'car Var))
>Lst ) ) ) )

Thanks, it works at home too, but with pop instead of ++ (I'm using
EmuLisp). I just replaced (++ Lst) with (pop 'Lst).

I'm quite surprised of the use of setq instead of let.
Could you please elaborate?
More precisely, I would have thought that
(foo smthng) would have bound 'smthng to X.


chri

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


Needing a trick with 'de

2017-10-13 Thread Christophe Gragnic
Hi list! (ha ha, a list…)

Could someone provide me with a function which looks like 'de
but is not 'de itself. Let's call it 'decar.

With de:

(de myfn args
  # here args is the list of the unevaluated args that were
  # given when calling myfn
)

With decar:

(decar myfn arg
  # here arg is the first arg given when calling myfn, unevaluated
)


This is my attempt:

(de decar args
  (let (fn (car args)
 arg (cadr args)
 body (cddr args))
(set fn (list (list "arg") (list 'let arg "arg" (list 'run body))

but I don't understand what I'm missing.
What do you think ?


chri

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


Re: Update your topics (GitHub)

2017-09-27 Thread Christophe Gragnic
On Wed, Sep 27, 2017 at 5:51 AM, Alexander Williams
 wrote:
> Sure, see json.l here:
> https://github.com/aw/picolisp-json/search?l=Common+Lisp

Thanks.
Maybe you could report those as being picoLisp files?
https://github.com/github/linguist/
Don't know how to fix this though...


chri

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


Re: Update your topics (GitHub)

2017-09-26 Thread Christophe Gragnic
On Tue, Sep 26, 2017 at 7:28 AM, Alexander Williams
 wrote:
> Hi all,

Hi everyone,

> GitHub provides the ability to search by language as well, but their
> algorithm doesn't always correctly identify PicoLisp code - probably due to
> incorrect coding style (*cough* like mine *cough*). Topics however, are
> user-generated.

Mine is correctly detected. Coding style should be irrelevant since
'linguist' knows very little about PicoLisp:
https://github.com/github/linguist/blob/master/lib/linguist/languages.yml#L3354
Could you provide us with links to your repos?

For those interested in history:
https://github.com/github/linguist/pull/1827
https://github.com/github/linguist/pull/1837
https://github.com/github/linguist/pull/1838
https://github.com/github/linguist/pull/2449


chri

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


Re: PicoLisp as first language

2017-07-31 Thread Christophe Gragnic
On Mon, Jul 31, 2017 at 4:07 PM, Nehal  wrote:
> Dear PicoLisp programmers,
>
> Hi! I am Nehal, a new PicoLisp learner and programmer from India.

Hi Nehal, hi India !

> I am currently working on making simple, easy to begin with PicoLisp
> Documentation for school students. […]

This is great. In my opinion PicoLisp is a good choice.
As Lindsay said, it could be a nice entry point for PicoLisp beginners,
something that I needed in my first attempts to understand it and
something I dreamt to build myself. I'll try to contribute.

Let me put EmuLisp and MicroAlg to your attention:
http://emulisp.js.org/
http://microalg.info/
Although this last website and the language it demonstrates is French only,
you'll understand why I think it can inspire you.

EmuLisp, initially developed by Jon Kleiser,
is a partial implementation of PicoLisp in JavaScript.
At first it was a toy project for him to understand the internals of
PicoLisp better.
But for me it was a game changer and allowed me to use PicoLisp in the browser.
Beware, it's not PicoLisp compliant, for example it uses floats.

The second is a pedagogical language, a «Lisp for babies» as a friend coined.
It is a embedded in PicoLisp and thus can run on:
* «the real» PicoLisp
* miniPicoLisp
* Ersatz (partial implementation of PicoLisp in Java, from Alex himself)
* JS (browser and node)
* …

If your students are familiar with UNIX they'll be able to use the
full language.
Ersatz can help if stuck on Windows.
The same for EmuLisp running on Node with less features but will have
a faster startup.
EmuLisp will allow you to make online interactive tutorials like I did in static
pages like here:
http://microalg.info/tuto_rapide.html
or with a plugin for Dokuwiki:
https://github.com/Microalg/dokuwiki-plugin-microalg
used here:
http://galerie.microalg.info/
(quite difficult to jump in for students, but very powerful).
In every MicroAlg interactive text field you can type regular PicoLisp code

Re: Floating Point numbers vs Fixpoint numbers

2017-07-12 Thread Christophe Gragnic
On Wed, Jul 12, 2017 at 8:36 PM, Jimmie Houchin  wrote:
>
> I didn't know if PicoLisp provided a solution without complicating every
> function which uses multiplication and division.

Yes, the */ function:
http://software-lab.de/doc/ref_.html#*/
I think you just have to provide 1.0 as the last param.


chri

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


Re: Introduction

2017-05-24 Thread Christophe Gragnic
On Wed, May 24, 2017 at 9:10 PM, Jakob Eriksson  wrote:
> I enjoyed the writeup

I did too. Sometimes I really enjoy unnecessary things.
Like this video, that I could watch several times in a row:
https://www.youtube.com/watch?v=5d7aruKYkKs
laughing to tears.

Welcome to this list Jimmie.


chri

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


Re: unit testing?

2017-02-08 Thread Christophe Gragnic
On Wed, Feb 8, 2017 at 12:13 PM, Alexander Burger  wrote:
>> I'm thinking of Python's `if __name__ == '__main__' and Perl's unless
>> (caller) {...}
>
> I don't know Python and Perl well enough. But perhaps 'once' is what you think
> of?
>
>(once (load "xxx.l"))

No, it's different.

In Python there's a «magic» variable named __name__.
As files can be:
- imported from another script/module
- interpreted directly from top leve
it provides a trick to distinguish between those two ways to use a
script/module.
See here:
https://docs.python.org/3/library/__main__.html


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


Re: (NIL) vs Nothing

2017-01-28 Thread Christophe Gragnic
Hi all,

On Fri, Jan 27, 2017 at 7:01 PM, dean  wrote:
> I've got this filtering function
>
> (de fltr (Buf Ln)
>(setq New_buf (mapcar '((Ele) (pack (tail (- (length Ln)) (chop Ele
>   (filter '((Ele) (pre? Ln Ele)) Buf

I'm not an expert, I just want to warn and maybe be confirmed.
As Alex said recently, PicoLisp programs should rarely use setq.
I'd add (please confirm):
1) especially in function definitions, as
2) it creates/modifies like «global variables», which many consider
bad practice.


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


Re: Discrepancies in lib/misc.l between picoLisp and miniPicoLisp

2016-12-15 Thread Christophe Gragnic
On Thu, Dec 15, 2016 at 2:22 PM, Alexander Burger  wrote:
> Hi Christophe,
>
>> Trying to port tests to miniPicoLisp I needed to copy some
>> definitions from lib/misc.l from pico to mini, and this is what I found:
>>
>> 1) Many definitions don't appear in pico. Is it intented ? If so, why ?
>
> Don't appear in *mini*, you mean?

Yes sorry.

> Well, yes, it is "mini" after all ;)

And I plan to make an even smaller version!

>> Just to mention my findings. It may be intented for the sake of
>> simplicity of mini.
>
> Thanks! I put 'format' in mini into my todo list :)

Glad to see you are interested.
Two others, but I understand that mini could have severe limitations that
would prevent a fix:
1) «seed» only accepts numbers in mini,
2) «in» doesn't support negative numbers in mini.

I'll keep you updated if I find some more.


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


Discrepancies in lib/misc.l between picoLisp and miniPicoLisp

2016-12-15 Thread Christophe Gragnic
Hi,

Trying to port tests to miniPicoLisp I needed to copy some
definitions from lib/misc.l from pico to mini, and this is what I found:

1) Many definitions don't appear in pico. Is it intented ? If so, why ?

2) Discrepancy in the $dat implementation:

mini
(format (pack (car S)))# Year
(or (format (pack (cadr S))) 0)# Month
(or (format (pack (caddr S))) 0) ) )   # Day

pico
(format (car S))   # Year
(or (format (cadr S)) 0)   # Month
(or (format (caddr S)) 0) ) )  # Day

Tests of $dat written for picoLisp don't pass without the pack in miniPicoLisp.
That's because the format function in mini doesn't accept lists.
Just to mention my findings. It may be intented for the sake of
simplicity of mini.


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


Re: Tests in PicoLisp

2016-12-14 Thread Christophe Gragnic
On Wed, Dec 14, 2016 at 2:53 PM, Alexander Burger  wrote:
> Hi Christophe,
>
>> In lib/test.l I read:
>> «««
>> Local usage:
>> # ./pil lib/test.l -bye +
>> »»»
>>
>> Shouldn't it be
>> «««
>> bin/pil lib/test.l -bye +
>
> Not really. The bin/pil script is a template to be copied or linked to 
> /usr/bin,
> i.e. a global installation. You see it from the hashbang line
> #!/usr/bin/picolisp /usr/lib/picolisp/lib.l
>
> The "true" PicoLisp local startup is the pil script in the installation
> directory.

OK sorry, I just noticed this other pil in the meantime.

>> test:
>>  $(bin)/pil $(lib)/test.l -bye +
>
> Hmm, why is this so important? It has nothing to do with make, and runs in a
> different context.

Sometimes people use make to run tests, right after a build.
No big deal here. Thanks for your availability.


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


Tests in PicoLisp

2016-12-14 Thread Christophe Gragnic
Hi,

In lib/test.l I read:
«««
Local usage:
# ./pil lib/test.l -bye +
»»»

Shouldn't it be
«««
bin/pil lib/test.l -bye +
»»»
or «./pil ../lib/test.l -bye +» or anything like that?


Also, I humbly suggest (once again) this kind of target in the makefiles:
«««
test:
 $(bin)/pil $(lib)/test.l -bye +
»»»


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


Re: miniPicoLisp and Emscripten: news, suggestions and questions

2016-12-11 Thread Christophe Gragnic
On Mon, Dec 12, 2016 at 7:35 AM, Alexander Burger  wrote:
>> I can compile with the bnd[99] trick, until some better idea is found.
>
> Oh! Does this mean that you allocate 99 entries on each call? This expoldes 
> the
> stack size :) And still might be too small if you e.g. 'apply' a longer list 
> to
> a function.

Indeed, that's what you explained here:
http://www.mail-archive.com/picolisp@software-lab.de/msg04472.html

> What about using alloca() ?

You already suugested this here (call this "patience"):
http://www.mail-archive.com/picolisp@software-lab.de/msg04465.html
but now I feel more confident in trying to implement it.
llvm has an alloca in its Intermediate Repr:
http://llvm.org/docs/LangRef.html#alloca-instruction
Still not sure if it maps to the C alloca.

>> In the Makefile, could we have
>> 2a) «CC=gcc» at the top of the file, then $(CC) instead of gcc in the
>> rest of the file?
>
> You are right! I will change that.

Thanks.

>> 2b) «%.o : %.c» instead of «.c.o»
>
> I never saw that. Is it portable? And what is it needed for?

It's a way to specify wildcards.
Sorry, I thought that my version was more mainstream.
I nevertheless find it more readable.

I could find some occurences here (please search for "%.o"):
https://www.gnu.org/software/make/manual/make.html
but couldn't find a dedicated section.

>> 3) Questions about tests
>>
>> 3a) About picoLisp64 now, is there a prefered way to test everything ?
>> `pil test/*.l` ? or something similar ?
>
> The entry point is @lib/test.l. See the comments about local and global usage 
> at
> the beginning of that file.

OK.

>> 3b) Would it be nice to have a `test` target in the Makefile ?
>
> I don't see that very useful.

It could at least serve as documentation (see my previous question!).

>> 3c) Are there somewhere tests for miniPicoLisp ?
>
> Unfortunately not ... :)

I'll try to maintain some for 2017.

Thanks.


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


miniPicoLisp and Emscripten: news, suggestions and questions

2016-12-11 Thread Christophe Gragnic
Hi,

I'm back at tweaking miniPicoLisp for it to be compilable by Emscripten.
I'm re-reading posts from a discussion we had:
http://www.mail-archive.com/picolisp@software-lab.de/msg04447.html
It's been 2.5 years now! I'm now a bit stronger in C and can
understand some more bits.

So I opened up my old directories and checked the actual miniPicoLisp.tgz.
I'm glad to see that miniPicoLisp still receives updates!


1) News

I can compile with the bnd[99] trick, until some better idea is found.
The real news is that I managed to make it compute 2+2 (woa).

$ cat test.l
(+ 2 2)
(bye)
$ nodejs picolisp.js < test.l
: -> 4
:
$ echo "(+ 2 2)(bye)" | nodejs picolisp.js
:
$ echo "(print (+ 2 2))(bye)" | nodejs picolisp.js
: 4

Now I have to investigate some more for convenient use
in the CLI and in the browser. Any input is welcome.


2) Minor suggestions

In the Makefile, could we have
2a) «CC=gcc» at the top of the file, then $(CC) instead of gcc in the
rest of the file?
2b) «%.o : %.c» instead of «.c.o»


3) Questions about tests

3a) About picoLisp64 now, is there a prefered way to test everything ?
`pil test/*.l` ? or something similar ?
3b) Would it be nice to have a `test` target in the Makefile ?
3c) Are there somewhere tests for miniPicoLisp ?

Thanks again Alex for providing such awesome software,
and thanks to the community for the warm atmosphere and
the discussions.


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


Re: misunderstanding executing data as code

2016-12-10 Thread Christophe Gragnic
On Sun, Dec 11, 2016 at 7:31 AM, Joh-Tob Schäg  wrote:
> One does not simply say that the pil interpreter is misunderstanding.

Indeed, but I think that here Dean was talking about his own misunderstanding.

> Secondly does 'pack fix your problem?

(pack Fn) would indeed be simpler than (glue "" Fn).
Maybe you need «any» ?

 (setq Fn '("e" "v" "a" "l"))
-> ("e" "v" "a" "l")
: ((any (pack Fn)) (+ 2 2))
-> 4


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


Re: Why print statement should determine whether I get an error or

2016-12-10 Thread Christophe Gragnic
On Fri, Dec 9, 2016 at 7:58 AM, Bruno Franco
 wrote:
> P.S.
> I'm still new to picolisp, so don't take any of what I say as gospel. And if
> anyone
> can confirm or expand on what I've said, I'd appreciate it a lot.

I'm not a veteran but let me expose what I once understood.

> I think that, in general, you want to quote a symbol when you want to change
> the value of that symbol when the function is evaluated. I think that not
> every function can do this, and I think it is called "destruction."
> […]
> So, if you wanna change what S is using set, quote it.
> If S is a list and you wanna change its innards, don't quote it.

I think that, although technically probably correct, the purpose of quoting or
not quoting may not be summed up like this.

> Here are some functions that behave different if you quote or not their
> symbol argument:
> inc, dec, push, pop, set, setq

Every function will behave the same, it only changes what you throw at them

Re: Incomplete documentation on 'need'

2016-12-03 Thread Christophe Gragnic
On Sat, Dec 3, 2016 at 10:54 PM, Bruno Franco
 wrote:
> I just wanted to point out that (doc 'need) for version 15.11.0 seems to
> miss something.
> […]
> I also wanted to ask if this kind of topic was appropriate for the mailing
> list. It seems so small that I wouldn't want to bother everyone just to
> point it out.

I can't say anything about 'need, but I can answer the last question.
This list is very friendly, especially with newbies.
You can ask any question or point us to anything.


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


Re: iterate over list until you find a match

2016-11-24 Thread Christophe Gragnic
On Thu, Nov 24, 2016 at 1:24 PM, Alexander Burger  wrote:
> Hi Dean,
>
>> : (T (== 1 1) T)
>> !? (T (== 1 1) T)
>> T -- Undefined
>> ..
>> i.e. I'm assuming this is a...
>> "A list is evaluated as a function call, with the CAR as the function
>> and the CDR the arguments to that function. These arguments are in turn
>> evaluated according to these three rules."
>> ..situation
>
> Correct.

Hi Alex, I'm not sure that you understood Dean's question.
Or maybe I didn't understand your answer.

What Dean did:
To understand your definition of mmbr, Dean extracted this line:
(T (== 1 1) T)
from the «for». Bad luck, the «for» function is what is called in some lisps
a «special form»: its arguments are not evaluated.
I think that in picoLisp it's called an f-expression.

Another example of a special form is the «if» function.
It doesn't evaluate every argument since it must first know
if the condition is true or false.
The evaluation of the true branch (or the false branch) is delayed
and done «manually».

Some examples in picoLisp:

: (de f (x) x)  # could have been defined with setq or set
-> f
: f
-> ((x) x)
: (f (+ 2 2))
-> 4

: (de f x x)  # could have been defined with setq or set
-> f
: f
-> (x x)
: (f (+ 2 2))
-> ((+ 2 2))  # the list of the args passed to f

: (de f x (caar x))
-> f
: f
-> (x (caar x))
: (f (+ 2 2))
-> +

The «for» function kind of inspects its args to find «clauses»
and treat them specially, not as usual function calls.
That's why brutally extracting them from
the «for» construct doesn't work.

An example of this kind is the «let» construct:

: (let (X "Hello" Y "world") (prinl X " " Y))
Hello world

Here X is not a function but a symbol to which "Hello" is bound.

We could also say that «for» and «let» are f-expr that use
some s-expr as data instead of function calls.

https://en.wikipedia.org/wiki/Fexpr
https://en.wikipedia.org/wiki/Sexpr

Hope this helps.


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


Re: stuck re quote

2016-11-22 Thread Christophe Gragnic
On Tue, Nov 22, 2016 at 11:29 AM, dean  wrote:
>
> Also I read that ' is a macro for quote but I couldn't produce a '
> equivalent of ((quote (X) (* X X)) 9) i.e.
>
> : ((quote (X) (* X X)) 9)
> -> 81
> : (('(X) (* X X)) 9)
> !? (('(X) (* X X)) 9)
> NIL -- Undefined
> ?
> : (('X (* X X)) 9)
> !? ('X (* X X))
> X -- Undefined

Your quote is misplaced. It should be:
('((X) (* X X)) 9)


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?subject=Unsubscribe


Re: Ersatz source code and EmuLisp

2016-10-31 Thread Christophe Gragnic
On Mon, Oct 31, 2016 at 9:57 PM, Jon Kleiser  wrote:
> Hi Chri,

Hi Jon,

> This is how you build ersatz/picolisp.jar, and at the same time get the 
> complete PicoLisp.java source:
> cd into the ersatz/, the do "pil mkJar +".

Things I already knew:
1) I knew the purpose and how to use mkJar but my question was more like:
in the end, what magic is behind it, like what is the role of «ex»…
2) I knew that it produced then compiled a .java file.

Things I learnt reading your answer:
Reading the .java file could help me more than the .src files !
Thanks.

> I have implemented (partly) a few more functions lately (format, intern, lit, 
> unless, when), but I haven't released anything new yet. I may find time to 
> look at 'filter'.

Great. Looking forward to it!

> Have you had any luck with Clojure(Script)?

Yes and no.
Yes since I managed to begin to implement my language with it,
with a really new vision. Clojure gave me some more ideas.
No since it's like I started one more project and time is limited.
Also, Clojure uses / as a namespace separator so I cannot
create a =/ function (which would translate to <>).
All in all, F-expr allows us to do miracles. Clojure can't compete
on this field. Macros are tougher.
But it has namespaces, that EmuLisp has not (PicoLisp has them).

Happy coding.


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


Ersatz source code and EmuLisp

2016-10-31 Thread Christophe Gragnic
Hi PicoLispers,

My question:
Is there any documentation about the building of the Ersatz jar ?
I guess all the keys are in the mkJar file but I'm lost reading it.

Background:
I'm mostly using a JavaScript version of PicoLisp: EmuLisp and
since Jon Kleiser has not much time to extend it further, I have
to try to extend it on my own (this is not a rant! Jon has been
very very helpful!).
If I understood the process correctly, Jon took inspiration from
the source code of Ersatz to structure EmuLisp, but this source
is still cryptic to me.

My current task is to implement 'filter.
This is it's Ersatz implementation:
https://github.com/fuxoft/picolisp/blob/1c6c501cd4ad5737ec74fa1de47201060fad39e3/ersatz/fun.src#L641
I tried to mimic 'mapcar
https://github.com/fuxoft/picolisp/blob/1c6c501cd4ad5737ec74fa1de47201060fad39e3/ersatz/fun.src#L562
and adapt the mapcar found in EmuLisp:
https://github.com/Grahack/EmuLisp/blob/master/emulisp_core.js#L1189
but there are too many things that I don't understand.

Can anyone help me ?


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


Re: Spring 2016 Lisp Game Jam

2016-04-19 Thread Christophe Gragnic
If you need more portability and don't need the DB, you could
use miniPicoLisp.
And what about Ersatz ?

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


Re: Redesigned Wiki is Live

2016-03-25 Thread Christophe Gragnic
On Fri, Mar 25, 2016 at 7:55 PM, Erik Gustafson
 wrote:
> The general theme of the feedback was that there is too much text,
> not enough super simple code examples […].

Indeed. I'm no PicoLisp expert but I don't know nothing either, and
the first code example seems convoluted.
Maybe there should be a trivial example like the factorial (maybe with
recur/recurse),
and a more powerful one related to the db and/or the html functions?

Also, it seems to me that the monospaced font seems a bit outdated,
especially beside the more modern ones we have now.


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?subject=Unsubscribe


Re: Redesigned Wiki is Live

2016-03-25 Thread Christophe Gragnic
On Thu, Mar 24, 2016 at 9:49 PM,   wrote:
> Please host the stylesheets on
> picolisp.com instead of using tracking CDN.?

I only see fonts (or infos about fonts + fonts) being retrieved from
fonts.googleapis.com, no CSS,
Although I may agree with this tracking defect, I guess retrieving
them from a CDN speeds up the page load for browsers that already have
retrieved the fonts for another website.
I'm no expert, maybe someone here can clear things up?

> Elsewhere-link at the bottom of main page
> -> why not generate here a link at random from a predefined list?
> -> like a list of links of repos/pages of picolisp-projects ? and the
> picolisp wikipedia article?

Nice idea ! I don't quite like this link pointing abruptly to
google.com too, especially for no real interesting reason.

All this said, this is great great work. Many thanks !!!


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?subject=Unsubscribe


Re: Tractatus Pico-Blaesicus

2016-03-08 Thread Christophe Gragnic
On Tue, Mar 8, 2016 at 9:45 PM, Mike Pechkin  wrote:
> hi,

Hi Mike,

> in the beginning of year I've wrote special preface for Forth or coding in
> general. In memory of Descartes. It describes zero step before coding.
> in Russian:
> https://medium.com/@tankfeeder/preface-8ea1e99d46f1#.yziufldc6
>
> p.s. My philosopher is Mamardashvili

Do you mean https://en.wikipedia.org/wiki/Merab_Mamardashvili ?

And could you please provide us with an English version ?
The automated translators that I tried produced nothing readable
(but I guess the original is somewhat «tarabiscoté»).


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?subject=Unsubscribe


Re: wr function in Ersatz

2016-01-02 Thread Christophe Gragnic
On Thu, Dec 31, 2015 at 12:37 PM, Alexander Burger  wrote:
>
> A better idea: Why do you bother with ErsatzLisp at all? If you don't
> have Linux or another POSIX system, instead of starting the Java-VM you
> might as well start a Linux-VM and run real PicoLisp with all features,
> and at full speed :)

Because where I work (school) and at the homes of the people I target,
such virtual machines are a big hurdle. It's very handy to ship a small
archive (<4Mo, Ersatz included).
In fact I don't really use the real PicoLisp!!!
Worse: I use EmuLisp even more than Ersatz!!!

Thanks for your answers ;)


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?subject=Unsubscribe


Questions about EmuLisp

2016-01-02 Thread Christophe Gragnic
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?subject=Unsubscribe


Re: A symbol that is bound only once

2015-12-30 Thread Christophe Gragnic
On Tue, Dec 29, 2015 at 11:40 PM, Rick Hanson  wrote:
> I admit that I didn't watch the video;

You should ! The guy is funny.
Alternatively you can read a page where I translate every step to PicoLisp:
http://galerie.microalg.info/profgra:tests:y_combinator
with live code samples (runnable and tweakable ones).

> so I don't know why `code` is
> even needed, considering that the following expression (which is your
> original expression but without `code` parts) gives you what you want
> anyway.

This little program is just a step in a transformation that exhibits the Y
combinator. «code» is meant to be bound to this code:
'((partial) (list '(n) (list 'if '(=0 n) 1 (list '* 'n (list partial
'(- n 1))
so we can replace this last line only with «code» in the program.


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?subject=Unsubscribe


Re: wr function in Ersatz

2015-12-30 Thread Christophe Gragnic
Hi all,

On Tue, Dec 29, 2015 at 8:44 AM, Alexander Burger  wrote:
>
> Partial documentations? Questions why it is not fully implemented?

Indeed. But anyway, here you have another question:
«why is it not implemented at all?» !

Maybe you could add those binary functions to the
«There is no support for:» section in the
http://software-lab.de/ersatz/README

Or will it take less time for you to implement them ;) ?

Anyway, I'm not even sure if wr is suitable for what I want:
writing image files like bitmap files from a list of bytes.
Is it? Or is 'wr only meant to be read with 'rd?


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?subject=Unsubscribe


Re: wr function in Ersatz

2015-12-28 Thread Christophe Gragnic
On Sun, Dec 27, 2015 at 10:18 AM, Alexander Burger  wrote:
> Hi Christophe,

Hi Alex,

>> Is there a reason why 'wr is not included in Ersatz?
>
> It is simply because the whole family of binary I/O functions is not
> supported.
>
> The plain 'wr' would be quite trivial to implement, but then there
> should be also 'rd' and 'pr' for completeness.

You mean «aesthetically»? Maybe even «API-sthetically»? ;)
Or is there a technical reason?

> The latter two functions need the PLIO format,

I don't know anything about this one, and any search about it is an unlucky one.
Could you provide some details ?

> and that's not available currently in ErsatzLisp.
> (In fact, PLIO for Java exists, in "java/InOut.java", so this could be
> all put together.)

I guess you wrote the sentence in parentheses after a bit of research.
I could not find anything about java/InOut.java myself though.

So there is some hope !


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?subject=Unsubscribe


A symbol that is bound only once

2015-12-28 Thread Christophe Gragnic
Hi all,
Sorry for this cryptic subject. I couldn't find a better one.

So here is a snippet:
http://pastebin.com/ydJj2DUU
(also as an attached file and pasted at the end of this email).

It's from this video:
https://www.youtube.com/watch?v=FITJMJjASUs
that I'm trying to translate to PicoLisp.

Could someone explain me why the symbol 'code is
bound to 'X in the first pass, but to NIL thereafter?

Thanks.


chri

(println
  (
('((code)  # The symbol 'code is bound to X only once.
  ('((gen) (gen gen))
'((gen)
  (println code)  # See the output from here.
  ('((partial) (list '(n) (list 'if '(=0 n) 1 (list '* 'n
(list partial '(- n 1))
   (list (cons 'quote gen) (cons 'quote gen)))
  ))
) 'X)
  5)  # (fact 5) is correctly computed then printed.
)

-- 

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)


y_comb_unbound.l
Description: Binary data


wr function in Ersatz

2015-12-26 Thread Christophe Gragnic
Hi,
This may be more a question for Alex.
Is there a reason why 'wr is not included in Ersatz?
Or am I missing something?

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


Re: bitmaps from random

2015-12-21 Thread Christophe Gragnic
On Mon, Dec 21, 2015 at 10:58 PM, Erik Gustafson
 wrote:
> Hi,
>
> […]
>
> The built-in 'wr' does just that - writes raw bytes to the current output
> channel.

Indeed. I missed this one. Thanks.
Oops, it seems that Ersatz doesn't have it.

On Mon, Dec 21, 2015 at 11:12 PM, Loyall, David
 wrote:
>> Suppose I implement the bmp format.
>
> Or, https://en.wikipedia.org/wiki/Netpbm

Useful, and in the spirit of PicoLisp (using external programs). Thanks.
In fact the implementation has already been done as a (fun) exercise
(and I need to rely on PicoLisp only).


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?subject=Unsubscribe


Re: PicoLisp Website

2015-12-18 Thread Christophe Gragnic
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?subject=Unsubscribe


Re: PicoLisp Website

2015-12-14 Thread Christophe Gragnic
On Mon, Dec 14, 2015 at 9:05 AM, Alexander Burger  wrote:
>
> So, yes, it is executed on the server. This feature opens up the server
> completely, so it is better not enabled on a publicly accessible system.

Hi all, hi Alex.

Maybe the job could securely be done by EmuLisp. But:
1) EmuLisp lacks the most powerful or esoteric/fun functions (DB,
pilog, among others…). On the other hand, it has OOP.
2) I don't know what its position is in the PicoLisp ecosystem.

Disclaimer: I love and use EmuLisp. In fact I use it more than the
real PicoLisp but my needs are specific.


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?subject=Unsubscribe


Hosting PicoLisp

2015-12-13 Thread Christophe Gragnic
Hi,

My host of choice is quite nice but doesn't allow me to
run my own processes. Everything must live behing Apache.
I guest most people on this list run their own servers but
maybe you'll have some answers to these two questions:
1) Is it possible to serve a PicoLisp app behing Apache?
2) Do you know a web host where we can easily deploy
a PicoLisp app?

Thanks.


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?subject=Unsubscribe


Re: PicoLisp Website

2015-12-13 Thread Christophe Gragnic
On Sun, Dec 13, 2015 at 6:51 PM, Erik Gustafson
 wrote:
> Hi all,
>
> Awesome! Thanks for the feedback. Glad you all like it :)

I liked it too. Very nice work.
I tried to investigate how you embed the REPL but no luck.
Could you explain please? Are the exprs executed on the server?!?

> […]
>
> Regarding supported platforms, I have a few ideas:
>
> […]
>
> - Just have the specifics right on the homepage, in its own section
>   with links as needed.
>
> […]

I'd personaly go for the second one. We could cast a vote.

Reading «PicoLisp runs on most every modern platform, including
mac/linux, windows, android» I thought about the various
implementations of PicoLisp:
1) A diagram would be nice.
2) Or maybe just a table, with functionalities dropped for each platforms.
3) Would there be some room for the alternate versions like Ersatz
   (which for me is the only way to run PicoLisp on Windows without
   Cygwin, or am I missing something?) or 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?subject=Unsubscribe


Adaptation in PicoLisp of a nice video in Ruby about the Y combinator

2015-12-02 Thread Christophe Gragnic
Hi dear list,

I wanted to share the first lines (already quite a few) of a work in progress.
I watched this video quite a long time ago:
https://www.youtube.com/watch?v=FITJMJjASUs
and wanted to see how a PicoLisp version would look like.
See what I've done so far here:
http://galerie.microalg.info/profgra:tests:y_combinator

Thanks to Jon Kleiser and EmuLisp the snippets are live.

Comments, fixes, suggestions are welcome.
Maybe I should put more links to the docs of PicoLisp.

Quite fun where we can go only with
println, +, *, quote, list and setq !!!


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?subject=Unsubscribe


Re: Announce: MCU based PicoLisp machines for sale

2015-11-03 Thread Christophe Gragnic
Thanks for the announcement.

On Wed, Nov 4, 2015 at 3:03 AM, Raman Gopalan  wrote:
>
> [4]: https://www.adafruit.com/products/284

http://www.4star.it/ worked better for me.


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?subject=Unsubscribe


PicoLisp now detected on GitHub

2015-06-17 Thread Christophe Gragnic
Hi list.

They even spelled it correctly !
https://github.com/github/linguist/pull/2449#issuecomment-112829159
See one of your repos or this one:
https://github.com/Microalg/Microalg

chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


A transient with a single hat character

2015-05-20 Thread Christophe Gragnic
Hi list,
Is there a way to have just ^ in PicoLisp ?
I read the docs, and especially this section:
http://www.software-lab.de/doc/ref.html#transient-io
and didn't find an answer to my question.
Maybe it would be nice to add this corner case to the examples ?

chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: In ersatz, seed is not returning a small number

2015-04-28 Thread Christophe Gragnic
On Tue, Apr 28, 2015 at 7:58 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Christophe,

Hi Alex.

 Is it really so important that the random generators give the same
 results?

Not so much important indeed, not crucial, but very interesting!

 I had never intended that. The reason is that the random generator
 should be as simple (fast) as possible,

Let's sum up what we have now concerning pil32 and ersatz:
(rand T) was already OK.
(rand x y) is now ok since the suppression of the (int) cast and the
use of 32 instead of 33.
(rand) is not OK, but I don't use it for the project which needs
reproducibility.

(seed) is not OK, and I'd like the results to match. I'd like my users
to be able to initialize the generator the same way across
implementations. Now what could support my request is the fact that
seed doesn't need to be so efficient since it should not be called
more than once.
What do you think ?

 and all four implementations represent numbers differently:

 1. pil32 […]
 Each bignum cell can hold 32 bits, where the sign
 bit is in bit 0 (no two's complement!). Therefore, the value is
 multiplied by 2, and the sign bit is added.

So this explains the ( n%2==0 ? n/2 : -(n-1)/2 ) trick. Great.
I wonder if this formula really works in all cases.
I tested a lot of cases, but not proved it.
Maybe I should take a pencil and some paper for better chances to convince you.
Or maybe you have a clear vision on this ?

 2. pil64 […]

 3. miniPicoLisp has only short numbers (in two's complement, either 30
bit on 32-bit machines, or 62 bits on 64-bit machines including the
sign).

Mmmh. I was not aware of this 30 bit thing.
This will be quite embarrassing when I'll embed in small chips, but not crucial.

 4. Ersatz […]

And pilMCU ? Ha ha, I'm just curious !

 So there is no natural way to get completely equal results.

Indeed, but for my purpose, I only need:
* pil32 (mainly for my dev machine, but not restricted to)
* java (desktop, but not restricted to of course)
* js (I have a better control on this one!)

So let's forget about (rand). I'm just asking for the n%2==0 ? n/2 : -(n-1)/2
trick for seed in the stock version of Ersatz. And I won't insist and bother you
if you refuse since:
1) you're the boss,
2) I could ship a modified version of Ersatz with MicroAlg (but I'd
prefer the stock one),
or implement a generator in PicoLisp (even if it would be slow).


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Pseudo Random Number Generation across PicoLisp implementations

2015-04-28 Thread Christophe Gragnic
On Tue, Apr 28, 2015 at 8:35 AM, Alexander Burger a...@software-lab.de wrote:
 Hi Christophe,
 […]
n = (Seed  32) % n;

 should it be OK?

Yes. It works. Great.

 Thanks for the input!

Thank you for considering it !

The 2)b) of my big email (april, 26th) of this thread was not answered but
I'll copy paste it in the seed thread since they seem related.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: In ersatz, seed is not returning a small number

2015-04-28 Thread Christophe Gragnic
On Tue, Apr 28, 2015 at 8:38 AM, Alexander Burger a...@software-lab.de wrote:

 Good, but this is not completely correct. It stores the reduced 32-bit
 value in 'Seed'. I think 'Seed' must keep the full 64-bit value.

Indeed. I'm not used to read lines with interleaved affectations.

 I changed it to

return new Number((int)((Seed = initSeed(ex.Cdr.Car.eval()) * 
 6364136223846793005L)  32));

 which is also more analog to pil32. What do you think?

That the results are analog, but different. To obtain exactly the same
results that pil32,
I had to write:

seed ()
long n = (Seed = initSeed(ex.Cdr.Car.eval()) * 6364136223846793005L)  32;
return new Number(n%2==0 ? n/2 : -(n-1)/2);

This is the same trick than the one I used to mimic (rand).
See below what I wrote on april the 26th in the other thread:

«««
2)b) I got stuck when trying to mimic the (rand) of pil32.
In doRand, at this line in big.c:
https://code.google.com/p/picolisp/source/browse/src/big.c#1213
return box(hi(Seed));
In Ersatz in rand (x n)
at this line: 
https://code.google.com/p/picolisp/source/browse/ersatz/fun.src#3325
return new Number((int)Seed);
This seemed so similar that I banged my head on the screen showing
the discrepancies between the results of pil32 and Ersatz that I couldn't
make disappear.
Then, I noticed a pattern, that leaded to reversing the sign bit trick you
just explained in initSeed: n=0? n*2 : -n*2+1;
One the one hand, Ersatz takes the lower 32 bits of the seed,
then returns them as a signed integer. But on the other hand,
pil32 takes the higher 32 bits as n (unsigned integer) and returns
n%2==0 ? n/2 : -(n-1)/2.
Correct ?
A question: why did you choose different implementations ?
Is it for a better efficiency in Ersatz ?
»»»

 Again, thanks for the input!

Again, this is really nice to have someone who really takes the time to listen.
Thank you Alex.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Pseudo Random Number Generation across PicoLisp implementations

2015-04-27 Thread Christophe Gragnic
On Mon, Apr 27, 2015 at 8:01 AM, Alexander Burger a...@software-lab.de wrote:
 […]
 A shift of 32 bits, however, would not suffice, because
 it would put the sign bit of the original 64-bit number into the MSB of
 the result.

OK, I understand.

I have some more ideas to try to make the behaviors of
(rand m n) in pil32 and ersatz the same, but maybe you are
not so much interested. Let me try one.
Would it be possible to just cast (Seed  32) to a long:

if ((n = evInt(ex.Cdr) + 1 - ((Number)x).Cnt) != 0)
n = (long)(Seed  32) % n;
return new Number(((Number)x).Cnt + n);

Some naive tests (see here: http://pastebin.com/hnnRLPA0) seem
to confort my idea, but I may have missed something (again).

If still wrong, I may implement a smaller generator specially for my
language. Like one with just Xn+1 = a Xn, and
a(m−1)2^53 (for ability to use withe JS numbers).
Inspired by Wikipedia and this paper:
http://www.ams.org/journals/mcom/1999-68-225/S0025-5718-99-00996-5/S0025-5718-99-00996-5.pdf
BTW, I wonder why MINSTD is not listed in Table 3.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Pseudo Random Number Generation across PicoLisp implementations

2015-04-26 Thread Christophe Gragnic
On Sun, Apr 26, 2015 at 5:48 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Christophe,

 […]

 return n=0? n*2 : -n*2+1;

 This ensures the return value is non negative (?).
 But why would not the result overflow?

 Yes, it may overflow. The above operation is to keep the sign bit in bit
 zero of the result. The sign bit is more important than the highest bit
 of the number.

Interesting. But I don't understand why the sign bit is so important
for the seed. Maybe it's related to what I discovered when working
on (rand), see below.

 […explanation about 2-complement…]

Ah ah ! In fact I realised this when working on the rand function.
It didn't occurred to me that it was also the solution for initSeed.
After sending the email about initSeed, I returned to rand.
I did take more time to test EmuLisp's new rand function,
in particular when sending it two args.

In fact rand worked better than I first thought since it gave
the same results than the Ersatz one. It is not proved, but
when I say the results are the same, in fact the results
matched for ten consecutive calls of (rand 0 1) which
is a quite high probability for «eternal» matching.
The quality of the tests is the same when testing (rand)
and (rand T), with respect to the space of the possible values.

Here I'll discuss
1: (rand 0 1)
2: (rand)
3: (rand T)

1)a) First, for (rand 0 1), my implementation in EmuLisp
was correct when trying to mimic Ersatz.

1)b) Moreover, when removing this line:
shiftedSeed = shiftedSeed.div(2);
which implemented the 33 instead of 32,
the results are the ones of PicoLisp32.

2)a) Then for (rand), my implementation accidentally borrowed
a line of pil32: getting the higher bits instead of the lower ones.
Now that the mistake is fixed it correctly mimics Ersatz.
I had to use the x2^31 ? x : x-2^32
trick (discussed by Alex) to mimic the (int) casting.

2)b) I got stuck when trying to mimic the (rand) of pil32.
In doRand, at this line in big.c:
https://code.google.com/p/picolisp/source/browse/src/big.c#1213
return box(hi(Seed));
In Ersatz in rand (x n)
at this line: 
https://code.google.com/p/picolisp/source/browse/ersatz/fun.src#3325
return new Number((int)Seed);
This seemed so similar that I banged my head on the screen showing
the discrepancies between the results of pil32 and Ersatz that I couldn't
make disappear.
Then, I noticed a pattern, that leaded to reversing the sign bit trick you
just explained in initSeed: n=0? n*2 : -n*2+1;
One the one hand, Ersatz takes the lower 32 bits of the seed,
then returns them as a signed integer. But on the other hand,
pil32 takes the higher 32 bits as n (unsigned integer) and returns
n%2==0 ? n/2 : -(n-1)/2.
Correct ?
A question: why did you choose different implementations ?
Is it for a better efficiency in Ersatz ?

3) (rand T) behaves the same across pil32, Ersatz and EmuLisp.

Alex, if nobody in the mailing list is against modifying the rand of
Ersatz, may I humbly ask you to use 32 instead of 33 ?
This change in the official Ersatz will allow me to have reproducibility
across the implementations of PicoLisp I use without asking my users
to use an unofficial version of Ersatz.

Also, it would be nice, but much less important to me since I don't use
calls to rand with no args, to have the same behavior for (rand) with
pil32 and Ersatz.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Pseudo Random Number Generation across PicoLisp implementations

2015-04-25 Thread Christophe Gragnic
Hi,
Still struggling. I'd like some help to find my mistake trying to understand
the Ersatz version of initSeed. The source is here, if you don't have it handy:
https://code.google.com/p/picolisp/source/browse/ersatz/sys.src#234

final static long initSeed(Any x) {

Means it gives back a signed 64 bits integer for anything we threw at
it (called x).


long n; for (n = 0; x instanceof Cell; x = x.Cdr) n += initSeed(x.Car);

Is a recursive trick that walks through x (if walkable, ie Cell) and cumulates
in n the results of initSeed for anything non walkable that was thrown at it.


if (x != Nil) {…

When the non walkable is not a list termination…


if (x instanceof Number  ((Number)x).Big == null) n += ((Number)x).Cnt;

If x is a 32 bits integer, just add it to n (not sure about the (Number) cast,
Number doesn't seem to have children).


else {
byte b[] = x instanceof Symbol? x.name().getBytes() :
((Number)x).Big.toByteArray();
for (int i = 0; i  b.length; ++i)
n += b[i];
}

If x is not a 32 bits int, get a bytes array (via its name if it is a
sym, or via its
array of bytes if it is a Java BigInteger, and cumulates the bytes in n.


return n=0? n*2 : -n*2+1;

This ensures the return value is non negative (?).
But why would not the result overflow?


Now if I'm correct until here, initSeed(1) should just return 2.
Then I don't understand why (seed 1) returns -5718471626015965606,
since (seed x) just multiplies the result of initSeed(x) by 6364136223846793005,
and 2*63641362238467930052^64 (no overflow).

See here for the source:
https://code.google.com/p/picolisp/source/browse/ersatz/fun.src#3308
only two lines:
n = initSeed(ex.Cdr.Car.eval()) * 6364136223846793005L;
return new Number(Seed = n);

Thanks reading so far !


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Pseudo Random Number Generation across PicoLisp implementations

2015-04-24 Thread Christophe Gragnic
On Thu, Apr 23, 2015 at 11:12 AM, Jon Kleiser jon.klei...@fsat.no wrote:

 Feel free to give it a try. As EmuLisp uses JavaScript numbers,
 6364136223846793005 is too many digits, but you may find a way around it.

Progress is being made.

I use this JS lib for arbitrary big integers:
https://github.com/defunctzombie/int

The changes in the EmuLisp code (inspired by Ersatz, as always) are here:
https://github.com/Microalg/microalg/commit/09e1a435c670c16047b67a3349a0599d1ef06bb4

It quite works but I must refine the shiftings (or maybe something else)
to try to get exactly the same values than PicoLisp or Ersatz.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Pseudo Random Number Generation across PicoLisp implementations

2015-04-23 Thread Christophe Gragnic
Hi,
After some more time to investigate, I found out that the LCG used in
PicoLisp was not the Haynes one, but the one referred as «Newlib» here:
http://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
More auto-answers and other questions below.

On Wed, Apr 22, 2015 at 10:50 PM, Christophe Gragnic
christophegrag...@gmail.com wrote:
 Now the question. I found discrepancies between PicoLisp:
 : (rand 1 1000)
 - 1
 : (rand 1 1000)
 - 934
 : (bye)

 And Ersatz
 : (rand 1 1000)
 - 1
 : (rand 1 1000)
 - 967
 : (bye)

 I tried to inspect the source for getting some explanation with no luck.
 PicoLisp
 https://code.google.com/p/picolisp/source/browse/src/big.c#1213
 Ersatz:
 https://code.google.com/p/picolisp/source/browse/ersatz/fun.src#3325
 Is there a reason for those different behaviours ?

Maybe I was too tired. The difference is 33, and we see in the Ersatz src:
n = (int)(Seed  33) % n;
But it is a coincidence since a bit shift should not have this effect
(confirmed when trying with the args 0 and 1000):
PicoLisp:
: (rand 0 1000)
- 0
: (rand 0 1000)
- 648
: (rand 0 1000)
- 760
Ersatz:
: (rand 0 1000)
- 0
: (rand 0 1000)
- 824
: (rand 0 1000)
- 880

Then I had to find the shift in the C code, which is hidden in the `hi` macro
(for high bits):
https://code.google.com/p/picolisp/source/browse/src/pico.h#161
#define hi(w)   num((w)BITS)
Where:
#define WORD ((int)sizeof(long))
#define BITS (8*WORD)

What I don't understand is why Ersatz shifts by 33, and PicoLisp by BITS,
(which should IMHO be 32). This connects to my next remarks/questions:
* The Wikipedia page mentions taking «bits 63...32». I guess that
  they start at bit 0, thus should the shift be 32 ?
* Is 33 used because of the sign bit ?
* In the PicoLisp src, why use LL and not ULL to define
6364136223846793005?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Pseudo Random Number Generation across PicoLisp implementations

2015-04-22 Thread Christophe Gragnic
Hi all,

The next paragraph gives a bit of context. If you are bored you can
skip it and go directly to the technical question.

I use PicoLisp to implement a pedagogical language, directly
embedded in PicoLisp. In an exercise about dices, I noticed a
kind of similarity among the results of my students.
Of course, that was because I didn't expose `seed`.
Students were quite disappointed: «but if we want to make games?»,
but I was not since:
1) I knew about the `seed` fix, now in use (like this: `(seed (time))`,
   since my goal is not security);
2) I found it was interesting to be able to check the results of the
   students;
3) It is a nice starting point to talk about PRNGs.
It even gave me a related idea (totally not interesting in a non
pedagogical context): let the user choose the sequence of the numbers
that will be «generated». This would be interesting to build exercises,
or for the students to test with a precise sequence.
Something like:
(de my_rand (m n)
# IF a special *list_of_numbers variable has elements
# THEN return the car of *list_of_numbers and circular-shift it
# ELSE return (rand m n)
)

Now the question. I found discrepancies between PicoLisp:
: (rand 1 1000)
- 1
: (rand 1 1000)
- 934
: (bye)

And Ersatz
: (rand 1 1000)
- 1
: (rand 1 1000)
- 967
: (bye)

I tried to inspect the source for getting some explanation with no luck.
PicoLisp
https://code.google.com/p/picolisp/source/browse/src/big.c#1213
Ersatz:
https://code.google.com/p/picolisp/source/browse/ersatz/fun.src#3325
Is there a reason for those different behaviours ?

Last thing (mostly for Jon), I read that the PicoLisp generator is
a 64-bit linear congruential random generator (both pil64 and pil32)
with the multiplier 6364136223846793005.
I'd like to implement this generator for EmuLisp. Any advice ?
Any objection ?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Static file server with Ersatz

2015-03-16 Thread Christophe Gragnic
Hi Alex, hi Joe.

On Mon, Mar 16, 2015 at 9:41 AM, Alexander Burger a...@software-lab.de wrote:
 Hi Christophe,

 but with Ersatz. Has it been done ? If not, would it involve:
 1) the use of the -server function in http.l

 I haven't thought about this in depth. 'server' might be ported to
 Ersatz perhaps, by omitting the (fork) stuff.

Mmf. I'll try to try something.

 2) grab the path of the requested file
 3) read the file and send it to the client
 4) write a little file explorer when requesting a directory

 I think this can all be done, by porting parts of the 'http' function.

OK. Thanks for encouraging me !

On Mon, Mar 16, 2015 at 1:21 PM, Joe Bogner joebog...@gmail.com wrote:
 Christophe, I wrote up an article a few years ago about creating a web app
 with ersatz and picoLisp:

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

I read this page which ranked quite high in my searches, but couldn't
find enough info.

 One of the subtle points of the article is that you need to modify the
 ersatz sources to remove the Static initialization of variables, otherwise
 it won't be thread safe.

Subtle indeed. Isn't it something suitable for Ersatz upstream ?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Static file server with Ersatz

2015-03-16 Thread Christophe Gragnic
Hi list,
I'm investigating a way to be able to fire up a static file server
like in Python:

python -m http.server 8000

but with Ersatz. Has it been done ? If not, would it involve:
1) the use of the -server function in http.l
2) grab the path of the requested file
3) read the file and send it to the client
4) write a little file explorer when requesting a directory
?

BTW, wouldn't it be more correct to say
«Then the -server function is called»
than
«Then the server function is called»
near the end of this section:
http://software-lab.de/doc/app.html#server


Thanks.

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Google Code closing

2015-03-13 Thread Christophe Gragnic
On Fri, Mar 13, 2015 at 4:32 PM, Alexander Williams
a...@unscramble.co.jp wrote:
 Everyone's comments are valid, but we need to remember:

 For PicoLisp's user base to grow, lowering barriers to entry should be the
 first priority.

The choice of the repo wouldn't have any effect on pure picolisp users,
but on developers or translators of the language.
Except maybe for contributing to documentation.

Personaly, I'd prefer git/GitHub since I already tried to contribute
to a project on BitBucket but failed miserably.
Anyway, I'm more a user than a dev of picolisp.

https://code.google.com/p/support-tools/wiki/MigratingToBitbucket
seems to require several steps.

https://code.google.com/export-to-github/
seems to be more automated, but:
«The Google Code Exporter is experiencing extremely high traffic. The
export queue is full. Please come back later. »


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


27 implementations of a Lisp

2015-03-13 Thread Christophe Gragnic
Hi,

I thought some people here might be interested by this:
https://github.com/kanaka/mal

Excerpt from the readme:
«««
Mal is a learning tool. See the make-a-lisp process guide. Each
implementation of mal is separated into 11 incremental, self-contained
(and testable) steps that demonstrate core concepts of Lisp. The last
step is capable of self-hosting (running the mal implementation of
mal).

The mal (make a lisp) steps are:

step0_repl
step1_read_print
step2_eval
step3_env
step4_if_fn_do
step5_tco
step6_file
step7_quote
step8_macros
step9_try
stepA_mal
»»»

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


Rainbow parens for vim users

2015-02-18 Thread Christophe Gragnic
Hi list.

I discovered this several weeks ago and thought this afternoon
that it may interest some of you.

Put this in .vim/ftdetect/lisp.vim
au BufNewFile,BufRead *.l set filetype=lisp

Then this in your .vimrc
let g:lisp_rainbow = 1
 for things like +-*/= to stay white:
hi def lispFunc   ctermfg=grey
 green transients:
hi def lispString ctermfg=darkgreen
 /real/ rainbow parens:
hi def hlLevel0   ctermfg=darkred
hi def hlLevel1   ctermfg=brown
hi def hlLevel2   ctermfg=yellow
hi def hlLevel3   ctermfg=green
hi def hlLevel4   ctermfg=cyan
hi def hlLevel5   ctermfg=blue
hi def hlLevel6   ctermfg=darkmagenta

I found it very interesting for students, but useful for me too !


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info


Re: Location of an error

2015-01-26 Thread Christophe Gragnic
On Sat, Jan 24, 2015 at 9:07 AM, Alexander Burger a...@software-lab.de wrote:
 Now when the code of the user/dev contains a mistake, the location
 of the error is always at the line where `my_while` is called and not in its
 body at the line of the mistake.

 I'm not sure I understand the problem.

I thought it would have been possible to be more precise.

 […]
 pointer is), not necessarily the expression which caused the error.

OK then. I'm in the process of changing my main commands (or functions)
from S-expr to F-expr. If the need comes, I may try to display the whole faulty
call with an indication of the location of the error. It should be possible

Suggestions for the doc of *Err

2015-01-24 Thread Christophe Gragnic
Hi,

I was trying to avoid the «? prompt» in case of an error.
I know that this REPL is sometimes useful, but not for my use case.
I eventually succeeded with (de *Err (bye)).

During this journey, I noticed a few things.
About *Err, the doc says in:
http://www.software-lab.de/doc/refE.html#*Err
«a `prg` body». I didn't notice the use of `de`, so I first tried
silly things like:
(setq *Err (bye))  # this one is funny
(setq *Err '(bye))
(setq *Err (bye))
But none worked. So I went to:
http://www.software-lab.de/doc/refP.html#prog
A beginner may think that the body of `prog` is not really a list.
A beginner would rather think that the body of `run`
(or rather its first parameter) is a list.
So I didn't know what to do from here, except going to the part of
the docs where `any`, `cnt`, `prg`… are explained:
http://www.software-lab.de/doc/ref.html#fun
where indeed 'run is mentionned.
http://www.software-lab.de/doc/refR.html#run
Then I went back to the doc of *Err:
http://www.software-lab.de/doc/refE.html#*Err
and noticed that the official way to set it is (de *Err (bye))
I would have find this clearer: (setq *Err '((bye)))
To me, the use of 'de here is convoluted. I eventually realised how
it may work. My guess is that since (de a (x)) defines a function
taking an  evaluated param x, that returns nothing (or NIL), the
value of a is ((x)).

I'd understand that these suggestions would not make their
way to the official docs, but I know for sure that the prompt
at the end of the example here is a ? and not a $:
http://www.software-lab.de/doc/refE.html#*Err

Anyway, I'm happy with PicoLisp !


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Location of an error

2015-01-23 Thread Christophe Gragnic
Hi all,

I emulated a «while» loop with a function defined with a `de`, say `my_while`.
It has a body that allows a user defined body (the user is a developer!)
to be executed, thanks to 'run.
Now when the code of the user/dev contains a mistake, the location
of the error is always at the line where `my_while` is called and not in its
body at the line of the mistake.
I tried to call 'run with an offset (vague memories of Tcl), but no luck.
Is there a way to be more accurate concerning this ?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Syntax Highlighting in PicoLisp

2014-11-22 Thread Christophe Gragnic
On Sat, Nov 22, 2014 at 8:37 AM, Alexander Burger a...@software-lab.de wrote:
 Hello list,

Hello !

 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?

 As I understand it, syntax highlighting marks symbols which are
 keywords in the language. However, PicoLisp doesn't have keywords.
 There are just symbols.

I perfectly agree with this, even though syntax highlighting may not
be restricted to symbols (no scoop here).

 It has built-in symbols, yes, but that doesn't make them special in any
 way.
 […]
 This is the reason why I use syntax highlighting only for comments in my
 editor. Comments can indeed be detected lexically. I've also
 experimented with strings (see *Tsm, transient symbol markup), but these
 are also symbols, with possible meaning depending on the context. And
 strings are clearly visible anyway.

Clearly visible, at a certain level, indeed, but it can help to spot mistakes.

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)

Syntax in src64

2014-11-11 Thread Christophe Gragnic
Hi Alex,
I was staring at this magnificent piece of code, say in this file:
https://code.google.com/p/picolisp/source/browse/src64/flow.l
and was wondering why and how some pieces of code didn't have parens.
My guess about the «why»: since its an assembler, there is no need for
a tree of instruction.
Now about the «how», I got lost trying to follow the Makefile…

chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Is there a 'conc that evaluates its first arg ?

2014-11-05 Thread Christophe Gragnic
On Wed, Nov 5, 2014 at 7:53 AM, Alexander Burger a...@software-lab.de wrote:
 Hi Christophe,

Hi Alex, hi all.

 I can assure you that 'conc' always evaluates its first arg.

OK, then the reason why there is no need to quote A in the example at:
http://www.software-lab.de/doc/refC.html#conc
is that A is not really needed as a symbol because conc changes
directly the value it links to.

 (dm push (elt)
(conc (:: elts) (list elt)) )  # this doesn't work

 'conc' destructively concatenates the arguments. This means that the
 pointer to the second list is stored in the CDR of the last cell of the
 first list.

 But here you pass (:: elts) as the first argument, which is the property
 cell in the symbol. That doesn't make much sense.

OK

 What you could do is

(dm push (Elt)
   (conc (: elts) (list Elt)) )

 But this works only if the property 'elts' is not empty (NIL). Because
 despite the fact that concatenating NIL with a second list returns that
 list, there is no storing in any CDR as a side effect, so the result of
 the 'conc' is lost.

 Thus, if you want to start with empty 'elts', you might do

(dm push (Elt)
   (=: elts (conc (: elts) (list Elt))) )

 In this way you don't lose the result of the first 'conc'.


 So is there a mean to implement the problematic line ?
 (=: elts (append (: elts) elt))

 This would be correct, and is basically the same as my proposal, just:

 but found it maybe not efficient (recreates the list?).

 Correct. 'conc' and 'append' are equivalent to a certain degree, at
 least as far as the return value is concerned. But 'append' copies all
 arguments except for the last one.

Great. I changed to your version which also makes the tests pass.

 Having said all this, if you want to implement 'push', why don't
 you use 'push' directly?

(dm push (Elt)
   (push (:: elts) Elt)) )

 This inserts the elements in opposite order as with 'conc' though, but
 that is what push is after all:

   […]

If it was only for me, that would be OK.
I chose to «push», which I call «Add_to» in my language, at the right side
of the list. I believe it's more natural for beginners (least astonishment)

Is there a 'conc that evaluates its first arg ?

2014-11-04 Thread Christophe Gragnic
Hi,
Maybe I should tell my problem as a whole.
I'm implementing a embedded language in PicoLisp.
I'm currently implementing lists with objects:

# Internals
(class +Liste)

(dm T (ELTS)
  (=: elts ELTS) )

(dm push (elt)
(conc (:: elts) (list elt)) )  # this doesn't work

# Interface with the language
(de Liste @
(new '(+Liste) (rest)) )

So is there a mean to implement the problematic line ?
I thought about something like:
(=: elts (append (: elts) elt))
but found it maybe not efficient (recreates the list?).


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Announce: PicoLisp in Hardware (PilMCU)

2014-09-19 Thread Christophe Gragnic
On Fri, Sep 19, 2014 at 7:08 PM, Loyall, David
david.loy...@nebraska.gov wrote:

 The Internet would like to run this locally.

Yes !

 Would you post the verilog source and build files?  Or a link to a repository?

Now PicoLisp should not be jealous of BF anymore:
https://github.com/briandef/bf16
(Quite funny that Alex's announce arrived a day or two after I was
aware of bf16.)

I had some questions but I see a mail from George…


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Ersatz: Passing/receiving floats to/from Java libs

2014-09-14 Thread Christophe Gragnic
Hi,
I was wondering how easy it was to pass floats to java libs from Ersatz,
and also maybe receive some and rescale them to ints.
I can't find anything about this in the docs of Ersatz or in
srborlongan's project:
http://picolisp.com/wiki/?JavaIterop
Thanks for having read this maybe silly question.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: (index 'any 'lst) implementation

2014-09-03 Thread Christophe Gragnic
On Wed, Sep 3, 2014 at 2:56 PM, Alexander Burger a...@software-lab.de wrote:

 What you describe here is call lazy evaluation. While some languages
 support this, PicoLisp (like most other Lisps) doesn't.
 […]
 The fundamental rule of Lisp function calls (a function recursively
 evaluates its arguments before it starts to run) is broken here.

But what about functions in PicoLisp that don't evaluate all their
args? f-expr are to me a big strenght of the language!


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Swimming against the tide, again (this time with numbers)

2014-09-02 Thread Christophe Gragnic
Hi all,

On Mon, Sep 1, 2014 at 6:05 AM, Tomas Hlavaty t...@logand.com wrote:
 : (* 1.0 1.0)
 - 100

 You want: (*/ 1.0 1.0 1.0), see http://software-lab.de/doc/ref_.html#*/

That's funny because I read about */ right before posting my email but
couldn't connect with my problem. If there is room for clarification, here
is my suggestion:
«…by multiplying with (or dividing by) the scale factor.»
could become
«…by multiplying with (or dividing by) the scale factor, which is always `1.0`.»
Suggested examples:
: (scl 1)
- 1
: 1.0
- 10
: (* 1.0 1.0)
- 100
: (*/ 1.0 1.0 1.0)
- 10

On Mon, Sep 1, 2014 at 6:23 AM, Alexander Burger a...@software-lab.de wrote:

 The solution would be to extend the internal representation of numbers,
 e.g. with an additional bit to distinguish between non-scaled and scaled
 integers.

I guess that you don't plan to alter PicoLisp this way.
And there is no magic way to alter the reader, or from Lisp?

 In fact, I would not try to explain it with these examples, but
 work _only_ with scaled integers first. Should be no problem for
 you as a math teacher.
 And then explain that the dot is just a read macro, not part of
 the language machinery per se.

My strategy for now is to only work with integers first, even with /.
Then explain that if decimals are needed, a scale must be choosen,
and numbers must be entered with a dot, or they will be read as
tenths for a scale of 1, millionths for a scale of 6…

I'll try to show, for a scale of 1, «1» instead of «10» using 'format cleverly.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: try picolisp

2014-09-01 Thread Christophe Gragnic
On Mon, Sep 1, 2014 at 5:52 AM, Tomas Hlavaty t...@logand.com wrote:

 […] it is unsafe by design.
 […]
 even if you bind those symbols to 'prog', an attacker could set them to
 the original values, which are simple numbers.

Hey, this is a very nice idea and answer to my question of safe interps.

 It should be possible to
 find the original values from another instance of picolisp, for example.

Is it always possible?

 Or simply call something that crashes PicoLisp, e.g.
 […]

Here comes the power of embedded interpreters, which PicoLisp
does not have.

Thanks to all for this interesting discussion !


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: try picolisp

2014-09-01 Thread Christophe Gragnic
On Mon, Sep 1, 2014 at 10:02 PM, Thorsten Jolitz tjol...@gmail.com wrote:

 could you elaborate on this a bit?

Sorry, I cannot give you better info that what is in the ref:
http://www.tcl.tk/man/tcl8.6/TclCmd/interp.htm#M4


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Swimming against the tide, again (this time with numbers)

2014-08-31 Thread Christophe Gragnic
Hi all crazy Lispers!

I managed to handle  being NIL, thanks to Michel and Alex.
Now I have another similar problem with numbers.
First, I understand the reasons behind having fixpoint numbers
in Picolisp (basically simple implementation and control).
Now considering that my goal is to implement a *simple* language
(no tricks no traps), I'm a bit stuck with the following behaviors:

: (scl 1)  # just for some examples to show
- 1
: 1
- 1
: 1.0
- 10
: (* 1.0 1.0)
- 100
: (+ 1 1.0)
- 11

It's is just impossible for a teacher to explain this to a newbie
without being considered a fool. PicoLisp being cool nonetheless.

So I'm looking for workarounds. I thought about two.

The first is a plain Lisp solution, but I would need to hijack the
READer to avoid 1 and 1.0 being different as soon as *Scl  0.
As for  and NIL, I think I could handle displaying the results.

The second is inspired by EmuLisp, which does not implement fixpoint
numbers but uses JS numbers instead. In the beginning,
I thought about implementing fixpoint numbers in EmuLisp,
but maybe the contrary would be easier to achieve my goal:
numbers a newbie can use, may it be floating point.

So I have two questions:
1) can we hijack the READer (from Lisp preferably) to implement
a custom numbers reading?
2) is there a magic hidden switch for Ersatz to use Java's ints
when a number is read as an int, and Java's floats when a
number has a dot? (ok, nice dream, try again…)


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: try picolisp

2014-08-31 Thread Christophe Gragnic
On Sun, Aug 31, 2014 at 12:09 PM, Tomas Hlavaty t...@logand.com wrote:

 would this clasify?

You mean «clarify»?

 $ cat /dev/null
 rm -fr /
 ^d

 I executed arbitrary script while limiting its effects.

Indeed.

 The most important missing part is to define, what functionality exactly
 do you want to allow and which effects are acceptable.

Some examples:
Allow: execution flow, setting/defining symbols, maths operations, print,
Deny: system calls (or controlled by ACL), file operations (or
sandboxed), redefine important symbols

 Even if you
 allow safe operations (whatever that means), users could spin your
 machine in a loop eating precious CPU time.  How would you limit that at
 PicoLisp or Tcl level?

Indeed. Admitedly derisory measures would be limiting number of iterations,
execution time…


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: try picolisp

2014-08-30 Thread Christophe Gragnic
On Sat, Aug 30, 2014 at 8:52 AM, Alexander Burger a...@software-lab.de wrote:
 Hi Christophe,

Hi Alex,

 I would not disable them system-wide.

Oops. Indeed.
In fact I'm still very influenced by Tcl. Tch has an «interp» command
that allow to create, and in fact cascade, interpreters.
Untrusted scripts will only be interpreted by embedded (so-called) safe
interpreters, and the interpreter of the main app is still a normal one.

 The critical point is only the place where 'eval' is called. I would
 […]

Thanks for providing these hints.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: try picolisp

2014-08-30 Thread Christophe Gragnic
On Sat, Aug 30, 2014 at 11:31 AM, Tomas Hlavaty t...@logand.com wrote:

 Executing a script doesn't mean every line will work as expected!
 `rm -fr /` can be executed, but doesn't always work ;)

 You see, then you are not allowing arbitrary functionality.

Maybe I should have said:
«Execute arbitrary scripts while limiting their effects.»


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: try picolisp

2014-08-29 Thread Christophe Gragnic
On Fri, Aug 29, 2014 at 6:45 PM, Amaury Hernández Águila
amhe...@gmail.com wrote:
 How do I quote someone? (I'm not that social and I've never participated in
 a mailing list before, do I just copy and paste and add the ?)

It's just what email clients do (including gmail, be it online, android app…).
Note that you just quoted me at the end. Maybe you just have to
click somewhere to avoid what is called «top posting» (posting a message
with the answer before the email where the question is).
Funny that you master quite complex systems with Docker and
don't know how to quote an email!

 Christophe Gragnic,

 If you use Docker containers…

Thanks for your proposal.
I'm just a (maths teacher) and ((computer science and dev) hobbyist
and teacher).
I try to build things that are as simple as possible.
Building, (and even only maintaining if already built) something like:
- web site
- triggering VMs or jails
- to run code
- that will output results to the user
frightens me as hell.


chri

---

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: try picolisp

2014-08-29 Thread Christophe Gragnic
On Fri, Aug 29, 2014 at 9:43 PM, Tomas Hlavaty t...@logand.com wrote:

 that is impossible, and even contradictory!  You can't allow arbitrary
 functionality and disallow some functionality at the same time.

Executing a script doesn't mean every line will work as expected!
`rm -fr /` can be executed, but doesn't always work ;)

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: try picolisp

2014-08-28 Thread Christophe Gragnic
On Thu, Aug 28, 2014 at 7:53 PM, Jakob Eriksson ja...@aurorasystems.eu wrote:
 Is it hard to implement minimalist version of minipicolisp in browser ?
 Like http://tryclj.com/ ?

Hi Mike.
There is EmuLisp, a JS implementation by Jon Kleiser.
It is not advertised much on the official PicoLisp website.
Jon wrote it as a pet project to understand the internals of PicoLisp better.
It is of course much closer to ersatz or minipico than the real picolisp,
and still far from complete but very usable.
At least, I use it! I use it in a real project (an embedded language,
with pedagogical purposes only).
Jon is very reactive and try his best to answer/implement my suggestions.

Home page:
http://folk.uio.no/jkleiser/pico/emuLisp/
Console:
http://folk.uio.no/jkleiser/pico/emuLisp/console.html
Semi-official and semi-main repo:
https://github.com/grahack/emulisp
A hint about the saneness of the implementation (how 'quote is implemented):
https://github.com/Grahack/EmuLisp/blob/master/emulisp_core.js#L931
The home page of my language (French only):
http://microalg.info/

 On August 28, 2014 7:41:12 PM CEST, Mike Pechkin mike.pech...@gmail.com
 wrote:

 Maybe not with Emscripten.

I once tried to compile minipico with emscripten. Discussed somewhere here:
http://comments.gmane.org/gmane.lisp.picolisp.general/4392

On Thu, Aug 28, 2014 at 7:52 PM, Michel Pelletier
pelletier.mic...@gmail.com wrote:
 The 64 bit version of picolisp can be ported to any machine.  There
 is an existing emulator that generates C code, another emulator that
 generated Javascript would be cool!

I once thought about http://asmjs.org/ but as I understand this project,
it is not what we could call a JS implementation of an asm.
Deceit.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: try picolisp

2014-08-28 Thread Christophe Gragnic
On Thu, Aug 28, 2014 at 9:32 PM, Jon Kleiser jon.klei...@fsat.no wrote:

 Thanks to suggestions from Christophe, I have
 re-structured the code,

And removed some trailing whitespace! (more to come (crossing fingers)).

 corrected some errors,
 and implemented a few new functions (more coming).

Some say OOP will come before Christmas.

 Christophe’s github repo has what I now call EmuLisp v.2.

Also, this repo is watched by Travis:
https://travis-ci.org/Grahack/EmuLisp

BTW Jon, I had to remove use strict; for now because of NodeJS.
I have to investigate why the strict mode makes the EMULISP object
not available to the JS script that launches the tests.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


NIL and

2014-08-23 Thread Christophe Gragnic
Hi all,

Is there somewhere some info about  being NIL?
I'd like to know why, maybe with some historical hindsight,
and if there is a mean to trick the interpreter?
The language I'm trying to embed in PicoLisp would love to have
 and NIL different !


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: NIL and

2014-08-23 Thread Christophe Gragnic
On Sat, Aug 23, 2014 at 3:13 PM, Alexander Burger a...@software-lab.de wrote:
 Is there somewhere some info about  being NIL?
http://software-lab.de/doc/ref.html#nilSym
http://software-lab.de/doc/ref.html#nilSym-io

Thanks. I knew about this links, I just wanted to know why.

 The language I'm trying to embed in PicoLisp would love to have
  and NIL different !

 Why? I believe this is a wonderful feature! A lot of PicoLisp's
 expressive power is a result of this universality of NIL.

This kind of answers my question !
I understand this being a power, a kind of polymorphism, like
in Python where the boolean value of , [],… is False.
But in the language I design, I'd like to have separate values
for  and NIL. In fact, NIL doesn't exists at all!

I'm afraid this is a big problem for me.
Maybe I'll try with a special symbol…


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Little mess around the docs in the ref

2014-08-22 Thread Christophe Gragnic
Hi,

`car` and `cdr` are ok but all the other combinations should point to:
http://software-lab.de/doc/refC.html#cXr

Also I didn't forget the thread about the docs that I started.
I may thank you and answer to all soonish.

chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Build transient value on the fly

2014-08-15 Thread Christophe Gragnic
Dear list, some updates about my problem.

I eventually decided to do the things The Good Way.
Adding a shortcut to EmuLisp was a fun hack, almost a joke, but not a
good idea as:
1) It was not EmuLisp anymore.
2) I may need this export functionality with other platforms (read
PicoLisp implementations).
3) Above all, I need this functionality with numbers too.

Now what I do is preprocess the source code with this:

(de protect_literals (src)
   (cond
  ((num? src) (list 'Literal src))
  ((str? src) (list 'Literal src))
  ((sym? src) src)
  (T  (mapcar 'protect_literals src))
)
)

Then handle numbers and transients like this:

(de Literal (content)
  (cond
((num? content) (pack block type=\nombre\field name=\TEXT\
  content
  /field/block))
((str? content) (pack block type=\texte\field name=\TEXT\
  content
  /field/block))
(T Is this really a literal?)
  ))

Works for me.
I also wanted to post this to have a free review by better PicoLispers than me;)


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


Documentation again

2014-08-11 Thread Christophe Gragnic
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

chri


Re: Build transient value on the fly

2014-07-29 Thread Christophe Gragnic
Le 29 juil. 2014 10:40, andr...@itship.ch a écrit :

 Why not redefine function Afficher?
 [...]
 Would that be an idea?

But this IS the idea I'm trying to explain!!!
The problem was to also redefine transient symbols, dynamically.

chri


Re: Build transient value on the fly

2014-07-28 Thread Christophe Gragnic
On Mon, Jul 28, 2014 at 9:27 AM, Tomas Hlavaty t...@logand.com wrote:
 Hi Christophe,

 No problem for Display, but hello should spontaneously have its value
 changed to some XML containing the string hello.

 in other words, you want to use the transient symbol hello as a
 variable?  What is preventing you?

The problem is that I would like to avoid maintaining a list of
all transient that will be used. The idea was to automatically,
or spontaneously, transform the value of _any_ transient
using its name as a base.
This would allow programs written in an embedded domain-specific
language to be exported with different formats, considering
that this embedded language would be reprogrammed.
And transient symbols too.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Build transient value on the fly

2014-07-28 Thread Christophe Gragnic
On Mon, Jul 28, 2014 at 9:11 PM, Tomas Hlavaty t...@logand.com wrote:

 I can't make sense of what you are trying to achieve.  Why do you want
 to use transient symbols?  Why not use normal interned symbols?  How
 does your use case differ?  Do you have a simple example?

Suppose you embed a DSL in Picolisp, like this:
(de Afficher (msg)
   (println msg))
Where «Afficher» is the French for «Display».
Now here is a simple program:
(Afficher Hello!)
When run it with the definition above, the message Hello! is displayed.

Now I want to export the program to XML to build a blocks configuration
for Blockly. An example built (then tweaked by hand) with:
https://blockly-demo.appspot.com/static/apps/code/index.html
block type=Afficher
  value name=TEXT
block type=text
  field name=TEXTHello!/field
/block
  /value
/block

Consider that Afficher is not the only command of the language.
There is a kind of «concatenate», a «read»…
The Lisp syntax is marvellous because the data I need to translate (the
program) is also source code (well, it was since the beginning!).
All I need is to reprogram my DSL like this:
(de Afficher (msg)
   (pack
 block type=\Afficher\value name=\TEXT\
 msg
 /value/block))

But I need transient symbols to spontaneously have the value:
block type=textfield name=TEXT*/field/block
Where * is the name of the transient symbol.
I could assign each transient the right value, but a bit of magic
would save time.

Is it better?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Build transient value on the fly

2014-07-27 Thread Christophe Gragnic
On Sun, Jul 27, 2014 at 3:09 PM, Tomas Hlavaty t...@logand.com wrote:
 Hi Christophe,

Hi. As I tried to explain in this sentence:

 No problem for Display, but hello should spontaneously have its value
 changed to some XML containing the string hello.

I had no problem with functions (I used a simple «de»).
The real problem is with transient symbols. Or maybe I missed something?
Thanks for trying to help.


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Build transient value on the fly

2014-07-25 Thread Christophe Gragnic
Hi,

The technical/dry question:
Is it possible to shortcut the value resolution of transient
symbols with a custom function? Something like:
(de shortcut_transient (name)
  (pack name !))
This would add a ! to the default value of a transient sym.
If I had to answer, I'd say «no», but PicoLisp is full of surprises!
I will need this functionnality in EmuLisp anyway so I'll
implement this. Any suggestion for a syntax/interface will be
appreciated.

BTW I had a related question (maybe for many months!):
Is there a PicoLisp function/mechanism like «unknown» in Tcl:
http://wiki.tcl.tk/795
(I'm a big fan of Tcl!!!)

Some context for the reason I need this kind of transient
manipulation (for the curious and because maybe I'm trying
to solve the wrong problem):
I'm embedding a language in Picolisp. I managed to build
Blockly blocks for this language:
http://microalg.info/ide.html (click on «Commandes»,
arrange blocks and see the generated code below).
This means I built the blocks and a generator that builds Lisp
programs from blocks configurations.
(for those who don't know Blockly:
https://blockly-demo.appspot.com/static/apps/index.html
https://code.google.com/p/blockly
)
I'm currently trying to do the converse operation:
build blocks configurations from Lisp programs.
(some docs and a live example
https://code.google.com/p/blockly
/wiki/Installation#Importing_and_Exporting_Blocks
See the XML tab here, after having built a program:
https://blockly-demo.appspot.com/static/apps/code/index.html
)
For this I need to produce XML from Lisp code. This is quite
easy considering that the data is not data but some source code.
The trick is to reprogram my language so that each command
will output some XML recursively (thanks to Lisp!!!).
I was quite happy to have this idea last night before sleeping, but
faced the transient problem in front of the screen this morning:
what about transient syms?

One example program: (Display Hello world!)

This should translate to:
block type=display
  value name=VALUE
block type=text
  field name=TEXTHello world!/field
/block
  /value
/block

I reprogram the Display command like this:
(de Display (content)
  (pack block type=\display\value name=\VALUE\
content
/value/block))

But I need Hello world! to have the value:
block type=text
  field name=TEXTHello world!/field
/block

And more generally (and this is the problem I post about), I need
any transient sym to dynamically have the value  (based on its name):
block type=text
  field name=TEXTany transient sym/field
/block

I note that this transient thing is VERY powerful. Alex, could you
provide us with some historical hindsight about transient syms? Do
they exist in other languages? Are they your brainchildren?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: Build transient value on the fly

2014-07-25 Thread Christophe Gragnic
On Fri, Jul 25, 2014 at 12:00 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Christophe,

Hi Alex.

 Hmm, so is this the same as the localization does in PicoLisp?

Quite the same, except that we don't have a list of all messages to
translate. Any transient, even an unexpected one, should
«spontaneously» have its value transformed by a function
when retrieved.

 I note that this transient thing is VERY powerful. Alex, could you
 provide us with some historical hindsight about transient syms? Do
 they exist in other languages? Are they your brainchildren?

 Transient symbols are just normal symbols, except that they have a
 file-local scope, and happen to look lexically like strings in other
 languages. That's all.

My question was about «look lexically like strings in other languages».
Do some other Lisp have this king of mechanism?


chri

-- 

http://profgra.org/lycee/ (site pro)
http://delicious.com/profgraorg (liens, favoris)
https://twitter.com/profgraorg
http://microalg.info
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


  1   2   >