Author Topic: Lisp in Basic  (Read 208199 times)

0 Members and 2 Guests are viewing this topic.

JRS

  • Guest
Re: Lisp in Basic
« Reply #270 on: August 09, 2014, 03:27:55 PM »
Quote
You can download raw source code and a precompiled executable from the FBSL site.

That updated zip looks a bit dated and still has the (/  ...) error. Your last post says redownload the zip. The file dates say 8/9.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #271 on: August 09, 2014, 03:38:04 PM »
It seems to me every language has a basic set of keywords and associated functionality that has to be implemented in the language for it to outgrow its Toy attribute. Are you sure SBLisp is currently broad enough to deal with the problems that "the gold standard" is capable of dealing with without external modules/libraries? I am not.

I can follow, and take part in, your effort in that direction. And I will be doing this just for the fun of it. You can delete my name from the SBLisp blurb any time -- I won't question it or even notice it because publicity isn't why I'm doing this.

But I'm not sure if I should be involved in building SB modules/extensions/bundles/whatever to connect the newly-born SBLisp object to your future activities and visions of its projected spheres of applicability. SB has everything it needs for this purpose thanks to Peter who did his best to see to it a decade ago. I can hardly add anything to it. And I'm an FBSL, not SB, developer after all. :)

If you (or we) can ensure the base functionality of SBLisp and, at the same time, its seamless interoperability with external modules/libraries then I don't see why you shouldn't take Scheme as a model to follow. Even if you are not able to jump over their head in the end, you'll gain valuable experience and a lot of fun in the process. :)

JRS

  • Guest
Re: Lisp in Basic
« Reply #272 on: August 09, 2014, 03:46:31 PM »
Okay. Let me know what you need me to do and I'll follow your lead. Getting SBLisp solid in it's current form seems like a good plan to me.

I'm still confused about what you said that SB expands it's arrays beyond the initialized state. Isn't there max array size variables being set to check for exceeding these predefined states?

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #273 on: August 09, 2014, 03:59:16 PM »
Quote
That updated zip looks a bit dated and still has the (/  ...) error.
Ain't no slightest idea what you're talking about. See the picture of (/ ...) running in the exe and raw script modes. I have just downloaded the zip from the site.

Quote
Your last post says redownload the zip. The file dates say 8/9.
The second picture is what my file dates and times say in my Russian WinRAR. August the 9th has ended exactly 3 hours ago here. It's 3 o'clock in the morning Sunday August 10.


If you don't see the same on your PC/notebook, perhaps you should clear your download cache and retry.


P.S. And please also note: this is not an FBSL port of your SBLisp. I created this script directly from the QB45 original. It may contain a couple of lines from SBLisp that wandered into there as a stencil while I was developing the both of them but it certainly isn't a port of your own code. That's why it doesn't contain either your blurb or your file load command line. Actually it doesn't contain my name either. :)

.
« Last Edit: August 09, 2014, 04:09:58 PM by Mike Lobanovsky »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #274 on: August 09, 2014, 04:26:20 PM »
I'm still confused about what you said that SB expands it's arrays beyond the initialized state. Isn't there max array size variables being set to check for exceeding these predefined states?
Judging from what I read in Peter's docs, you might not need any initialization at all. If it is so, then SB's arrays behave exactly like FBSL's dynamic arrays: their elements are created totally on the fly at the moment they are referenced in the code for the first time if they haven't been referenced yet.

Just for the heck of it, try the following and see what happens in your Linux:

Code: [Select]
  maxheapsize=4000
  'FOR mem = 0 TO maxheapsize
  '  heaptype[mem,0] = 0
  '  heaptype[mem,1] = 0
  '  heapvalue[mem,0] = 0
  '  heapvalue[mem,1] = 0
  'NEXT mem

  maxsymboltablesize = 2000
  FOR mem = 0 TO maxsymboltablesize
    symbols[mem] = ""
  NEXT mem
  slotsfilled = 0

  maxstacksize = 2000
  'FOR mem = 0 TO maxstacksize
  '  stacktype[mem] = 0
  '  stackvalue[mem] = 0
  'NEXT mem

 ::)

JRS

  • Guest
Re: Lisp in Basic
« Reply #275 on: August 09, 2014, 04:31:04 PM »
Works fine. That isn't my concern. Isn't a maxheapsize check done in the program and an out of memory error occurs if exceeded?

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #276 on: August 09, 2014, 04:48:46 PM »
1. Have you tried it or not?

2. If that trick works then why not just change 4000 for maxheapsize to, say, 40,000,000 and maxstacksize, to 10,000,000 just for starters? And let the computer decide when it should really clear its stack? The test (Rec_Test.lisp or whatever it was called) should then hardly ever print GC start GC done. :)

JRS

  • Guest
Re: Lisp in Basic
« Reply #277 on: August 09, 2014, 04:53:37 PM »
Yes I tried it. (REM out FOR/NEXT init)

That was my next question, what triggers auto GC.


JRS

  • Guest
Re: Lisp in Basic
« Reply #278 on: August 09, 2014, 05:05:36 PM »
Used your recommended settings for the max values and never saw a GC message well over five minutes into it.  8)

.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #279 on: August 09, 2014, 05:14:33 PM »
Used your recommended settings for the max values and never saw a GC message well over five minutes into it.  8)

Yeah, actually my ad libitum didn't work (I must study MyAlloc+mem manager more closely to tell you why) but 40,000 for heap and 20,000 for stack works. :P

Goto line 1808 to see

Code: [Select]
  IF hpcursor + 3 > maxheapsize THEN
    bsd += 1
    GOSUB GarbageCollect
  END IF

hpcursor is the current heap top pointer. When it grows to maxheapsize-3, it triggers the GC. Recursion is always a very heavy operation, and this garbage collection has too much to do interpretatively in its For/Next loops.

.
« Last Edit: August 09, 2014, 05:28:05 PM by Mike Lobanovsky »

JRS

  • Guest
Re: Lisp in Basic
« Reply #280 on: August 09, 2014, 05:24:12 PM »
Remember I'm running 64 bit so numbers and available memory are greater.

I'm thinking of removing the array inits  FOR / NEXT loops and any checks against their max values. Can you see any issue with that?


Garbage Collection:  UNDEF heaptype

This releases the memory used to store the SB array.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #281 on: August 09, 2014, 05:40:02 PM »
1. You can experiment but don't upload to the repo yet.

2. Try to find the max practical (= allowable) values for maxheapsize and maxstacksize values. Add something to print in the loop (e.g. the x value) to know that all is going well while GC start GC done aren't yet seen. Note however that printing is slow to execute so be patient.

3. The arrays should be released and recreated when the program ends --> this is recursion after all, and the mem structure should stay untouched in the process. If the arrays aren't released at all then the LISP "process" memory will be reusable after the program ends but it will stay bloated as in my picture that I added above. Scriba's footprint was only 2.5MB when it loaded lisp.sb. Everything else is the effect of recursion that expanded the heap array.


At the moment, I have no other info to share. That's where true experimentation/optimization really starts. :)

JRS

  • Guest
Re: Lisp in Basic
« Reply #282 on: August 09, 2014, 05:46:41 PM »
Lets go with numbers that work on your 32 bit box. I don't want something that works for me on Ubuntu 64 bit and not work on someones XP box.


Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #283 on: August 09, 2014, 05:51:34 PM »
We can do that in parallel. Or you can put it all on my shoulders only if you send me a 64-bit scriba.exe for Windows. Then I'll be able to test under my x64 Win 7 as well.

But it won't be fair. Huh, imagine me working on a Sunday morning while you're enjoying a cigarette and a few beers in a local bar...  >:(

JRS

  • Guest
Re: Lisp in Basic
« Reply #284 on: August 09, 2014, 05:56:45 PM »
Not a chance. My chains have a limited length. You will not be alone.


As you have said many times, it's still a 32 bit world. I'm good with a SBLisp based on that platform.