Author Topic: Lisp in Basic  (Read 208378 times)

0 Members and 1 Guest are viewing this topic.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #510 on: August 18, 2014, 01:23:27 AM »
Hi Rob,

From there my question if the provided documentation was sensible.
Entirely sensible, precise, and comprehensive. The best of the two worlds. :)

Quote
"Übung macht den Meister"  8)
Jawohl! :)

Quote
i can address allocatable memory now from within Bigloo
Congratulations and thanks for the sample! :)

That red screen definitely has some fine structured symmetry hidden in it. Can it be revealed graphically to see if it has any aesthetic value?

JRS

  • Guest
Re: Lisp in Basic
« Reply #511 on: August 18, 2014, 01:24:54 AM »
Quote
Why should you? ECL is by far more able than SBLisp and will always be.

Here is the API I need to use to create a SB ECL extension module in C BASIC. My ECL setup on my Ubuntu 64 bit box seems to be working fine.

ANSI Dictionary — Common Lisp and C equivalence

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #512 on: August 18, 2014, 01:27:31 AM »
Hi Aurel,

Guys i am not sure but i think that i see ( one one site ..sorry i don't remeber where) that there is a version of Lisp written in sinclair QL superBasic.

Thanks for the info. Yet I think QB45 is much closer to O2/SB/FBSL than Sinclair in its syntax making it a better choice for a quick port job.
« Last Edit: August 18, 2014, 01:35:55 AM by Mike Lobanovsky »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #513 on: August 18, 2014, 01:35:23 AM »
Here is the API I need to use to create a SB ECL extension module in C BASIC.
So what's missing to have it created?

JRS

  • Guest
Re: Lisp in Basic
« Reply #514 on: August 18, 2014, 01:48:46 AM »
Quote
So what's missing to have it created?

Working on it. So far my tests have been successful.

The ECL API is HUGE. (see attached)

Bare bones ECL includes.
Code: [Select]
#include <ecl/object.h>
#include <ecl/external.h>
#include <ecl/cons.h>
#include <ecl/stacks.h>
#include <ecl/number.h>
#include <ecl/legacy.h>

I think we are on the right track with XBLisp. No way am I going to wrap that ECL monster.

.
« Last Edit: August 18, 2014, 02:38:40 AM by John »

JRS

  • Guest
Re: Lisp in Basic
« Reply #515 on: August 18, 2014, 03:00:14 AM »
The only thing that make any sense with ECL is using it with C BASIC. No wrapping, just include and use the functions. SDL_gfx can be included as well. That is where Rob should be putting his efforts into. IMHO

HERE is a PDF listing of SBLisp color syntax highlighted from Ultra Edit. (Linux version)
« Last Edit: August 18, 2014, 03:17:48 AM by John »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #516 on: August 18, 2014, 03:46:49 AM »
John,

I suddenly had a very bright idea on how it all can be simplified using SB/FBSL's own ON ERROR functionality. It makes the code incompatible with OxyLISP that doesn't have an ON ERROR mechanism but that will have to wait till better times.

I'm abandoning my yesterday's work and re-writing the code once again from scratch.

P.S. I'm using FBSL's Eclecta to work with SB code. It's equipped with an automatic real time drop-down combo list of subs/functions and its syntax highlighter is perfectly suitable for the task as well. :)

P.P.S. Your current FUNCTION TestThenScan is buggy. It contains invalid returns referring to a non-existent entity CopyUsefulMemory! That's where implicit creation of variables starts to play its dirty tricks on us. ;)

P.P.P.S. Hehe, the new HandleError() implementation is working Just Great! :D Proceeding to the operation on the Siamese twins with a brand new razor sharp lancet in hand...
« Last Edit: August 18, 2014, 06:29:43 AM by Mike Lobanovsky »

RobbeK

  • Guest
Re: Lisp in Basic
« Reply #517 on: August 18, 2014, 03:48:19 AM »
Hi Mike,

"some fine structured symmetry hidden in it"

Set up a "dirty" zoom for a closer look  (  but , "dirty" - no recalculations , just screen copies -- will be worse every click )

Code is opitmized "  for benchmarks " now ( can slightly run faster be declaring the integers fixed ).

best Rob
(speed is good , I have my tools now  :-*, I'll work on the XBLisp this evening/night )

.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #518 on: August 18, 2014, 03:59:40 AM »
Thanks Rob!

Rien ne va plus occurs too early... :D

I was talking about finding some coloration algo to try and reveal this symmetry visually. I wonder if this could make the plot more aesthetically attractive. You know I'm always hypnotized by interference patterns and such, especially in 3D. :)

And thanks for the good news about XBLisp too!

RobbeK

  • Guest
Re: Lisp in Basic
« Reply #519 on: August 18, 2014, 06:04:39 AM »
Warming up a little for Xbisp ..

(ah, ok -- those symmetry comes from the fact that x²+y² == (-x)²+y²   etc...  (nothing that can be used for the 1.000.000$ Riemann proof  :'(  )

OK, the Lisp .. 
I noticed it misses something very elementary ,  the (cadr ... ) , it so much used it should be there (though it can be defined from things available )
My idea is consequently while I write those examples at the mean time writing a kind of ini.lisp file with often used functions.

the "cadr" means simply the second element of the list but is written as the first element of the rest (minus the first) of the list .
you have   a::  '(a b c)       (car a) ->a   (cdr a) -> (b c)  (cadr a) ->b

the nomenclature from the IBMs from the 1950s  8)


    car (short for "Contents of the Address part of Register number"),
    cdr ("Contents of the Decrement part of Register number"),
    cpr ("Contents of the Prefix part of Register number"), and
    ctr ("Contents of the Tag part of Register number"),
(wikipedia)

So, attached :
my definition of cadr  -----> (should belong in the ini.lisp file)
the way I should handle pseudo-iteration   ( I first built a helper function which does the pseudo-iteration and accumulation )

can you test the speed compared with previous ?    t.i.advance

best Rob  ,,     (will start with source txt files now -- easier to comunicate)
oops , this time the sequence starts with 0,1,1,2,3   replace in the aux. function the (car L) with (cadr L) to start at 1,1...

.
« Last Edit: August 18, 2014, 06:16:00 AM by RobbeK »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #520 on: August 18, 2014, 06:22:55 AM »
Thanks a lot again, Rob!

Quote
sblisp wordt niet herkend als een interne
of externe opdracht, programma of batchbestand.

Please make it English, French, or German. I can't read that yet but I'm hoping to, with time and your assistance. :D

You can write whatever macro includes you like but I'm inclined to add new keywords only if they are legitimate parts of standard Scheme vocabulary. Is (cadr) officially recognized and supported in Scheme? If yes then can you also write down a full list of Scheme's other basic keywords for me that XBLisp is still missing?

P.S. You can use ; in your XBLisp code to denote comments. It isn't described in the PDF but it works.
« Last Edit: August 18, 2014, 06:37:06 AM by Mike Lobanovsky »

RobbeK

  • Guest
Re: Lisp in Basic
« Reply #521 on: August 18, 2014, 07:02:13 AM »
Hi Mike,

I'm from Flanders and that's my lingo (there are more people in NY than ....    ).

It is described in the standard as

--------------------------------------------------------------


library procedure: caar pair
library procedure: cadr pair

...: ...

library procedure: cdddar pair
library procedure: cddddr pair

    These procedures are compositions of `car' and `cdr', where for example `caddr' could be defined by

    (define caddr (lambda (x) (car (cdr (cdr x))))).

    Arbitrary compositions, up to four deep, are provided. There are twenty-eight of these procedures in all.

-------------------------------------------

so every combination upto c....r  , however these are called "library procedures" i.o. "procedures"  (maybe just because it are composites , nevertheless I noticed them in any Scheme ever used )

so, the caddr , is the 3rd element of a list ///  etc

(we can always name the ini.lisp something as lib.lisp in case  8)

best Rob

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #522 on: August 18, 2014, 08:24:03 AM »
OK Rob,

If they aren't part of standard inbuilt vocabulary but rather library procedures (or macros, for that matter), let's better keep them in a separate "library" module (ini.lisp or lib.lisp file) loadable on XBLisp start. Your XBLisp (the .exe that you have) can't recognize more than one filename to load on startup so a
Quote from: Command line
sblisp.exe lib.lisp fibonacci.lisp
command line isn't possible but I'm currently reworking its code and I will add this functionality too.

JRS

  • Guest
Re: Lisp in Basic
« Reply #523 on: August 18, 2014, 09:36:14 AM »
Outstanding progress Mike!

I have a feeling I'm not going to be able to recolonize our kid once you get done with your course corrections.  8)

I'm going to try and get a  C BASIC version of the Mandelbrot example using SDL_gfx and ECL libraries posted. No promises!

@Rob - Can you post a Common-Lisp version of your Mandelbrot iterator so I can try this with C BASIC & ECL?

« Last Edit: August 18, 2014, 10:11:56 AM by John »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #524 on: August 18, 2014, 10:13:43 AM »
Morning John,

I'm two thirds through with the fission process and everything's OK so far. While LispPrint is self-recursive and LispEval is self-recursive too, ReadSExp and ReadSExpSeq appear to be self-recursive, mutually recursive, and multiply recursive with LispEval to an unlimited depth. My yesterday's scheme simply wasn't able to cope with such unlimited interleaving and recursion in principle but my present scheme is.

And if "recolonize" in fact means "reformat" then I can assure you that my formatting is perfectly consistent with your rules.

There will however be just one request. The code now contains a few of my comments on what is being done here and there and why. Please let them stay in the sources until further notice when everything has been perfectly tested.