Author Topic: Lisp in Basic  (Read 208377 times)

0 Members and 4 Guests are viewing this topic.

JRS

  • Guest
Re: Lisp in Basic
« Reply #450 on: August 15, 2014, 11:10:13 PM »
Quote
But John, I'm a GUI guy, I don't really see why you are all so happy with this ugly black hole in your monitors.

I have lofter goals. I would like to see this combo be used as a introduction to programming. Teach traditional BASIC then follow up with Lisp using SBLisp as a model for how one might write a Lisp interpreter. The C BASIC extension modules might be a way to roll teaching C in to this.If I can get Arthur interested, he is in a perfect position to make course matter out of this. Well, that's the plan anyways.

I also think this way of dealing with function errors will allow us to expand on the error reporting with more info.
« Last Edit: August 16, 2014, 01:19:52 AM by John »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #451 on: August 15, 2014, 11:33:12 PM »
Hehe, can we write a console Tetris or Space Invaders in this XBlisp thingy and (re)register at that retro-BASIC serpentarium on account of the underlying BASIC? ;D

JRS

  • Guest
Re: Lisp in Basic
« Reply #452 on: August 15, 2014, 11:34:47 PM »
Hehe, can we write a console Tetris or Space Invaders in this XBlisp thingy and (re)register at that retro-BASIC serpentarium on account of underlying BASIC? ;D

Leave the toys to the boys.  We will be able to do games and other graphic programming as soon as we get the SDL GFX extension module plugged into SBLisp.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #453 on: August 15, 2014, 11:36:35 PM »
... a console Tetris or Space Invaders ...


   

;)
« Last Edit: August 15, 2014, 11:43:47 PM by Mike Lobanovsky »

RobbeK

  • Guest
Re: Lisp in Basic
« Reply #454 on: August 16, 2014, 01:35:11 AM »
Hi John , Mike ...

Yes  , they are isomorphic but they do not share the same memory location (pointer),   so they do not "eq"

(setq a '(something))
(setq b a)

(eq a b)  -> T   (these share the same memory location)   : you have to use equal for isomorphic compare.   (and = for numbers).

Mr Lutz Mueller from NewLisp was able to condensate this potpourri in one single =  (but I think you need lexical scoping then - while CL is dynamical )

https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node74.html

This comes with an even more severe warning about Lisp (espec. when coming from C, Pascal etc ...  ) have a look

(setq a '(1 2 3 4))
(setq b a)

a -> (1 2 3 4)
b -> (1 2 3 4)

(incf (elt a 0))     -increment the value of the first element in the list a

a -> (2 2 3 4)
b -> (2 2 3 4)     ::)       yep, try it

(this because they point at a same object  - always try to think in pointers when working in Lisp )

The iceberg and other stories : 
---------------------------------------

The mechanism behind the code was correct , but parallel assignment seemingly not   :'(

this is the correct syntax in NewLisp

LispCode =
"(define (fib n) (if (and (number? n) (> n 2))
    (let ((L '(0L 1L)))
      (dotimes (i n)
        (setq L (list (L 1) (+ (L 0) (L 1))))) (L 0) )
     'I-can-not-do-such-a-thing.) )"

A quick example in tB  attached   :   try Fib(100.000) it will be there in less than a sec  8)   --- even interpreted ----

best Rob

(oops , yes remark the difference between (dotimes ...) between NewLisp and CL

CL   (dotimes (i x return-value) ....  )
NL   (dotimes (i x [ exceptional-end-condition ] .....  )     

My Fib starts with 1,1,2 (and indexbase 1)   -- there may be people starting their sequence with 0,1 or even 1,2  -- the nth value may be different

.
« Last Edit: August 16, 2014, 01:59:13 AM by RobbeK »

JRS

  • Guest
Re: Lisp in Basic
« Reply #455 on: August 16, 2014, 02:02:59 AM »
Rob,

Whatever theories you wish to test between Lisp variation, please include SBLisp if you can. Lisp is confusing enough and all these different syntax variation is starting to drive me nuts.  ??? We need help testing SBLisp! A standalone Windows 32 bit version is available on the Bitbucket site.

JRS

  • Guest
Re: Lisp in Basic
« Reply #456 on: August 16, 2014, 02:21:25 AM »
Quote
... a console Tetris or Space Invaders ...

My belief is that you should never lose your console skills and control. When the GUI fails, you are left with a console to recover.


Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #457 on: August 16, 2014, 03:06:28 AM »
John,

Please take the following seriously.

When my Windows GUI fails me, it means I should get dressed, go out, and buy me a new monitor and/or video card.

I haven't had a single GUI crash under any of my Window's in years though it is GUI programs that I'm developing and debugging all the time.

Running a console in Windows is like "driving" a Bentley that's tied to a horse's tail.

When your Linux GUI fails you, it means you're running yet another home brewed desktop manager and you should immediately either roll back by some 5 to 10 updates of your kernel to find the one that would be compatible with your GUI, or abandon the GUI idea altogether and subside to your telety.... oh, excuse me, your terminal.

The only exception to this bad omen of the Linux world is elementaryOS which owes its graphical stability to the extreme simplicity of its basic functionality. I'm using it now gladly and you know I almost fell in love with this distro the moment I saw its Luna release. But I spent two weeks taming it to the gait that would be suitable for my needs. I believe you saw my desktop screenshots, didn't you.

I am firm in my attitudes but I can also admit my fallacies whenever I come to see the reality around me has changed. But nothing's gonna take me 30 years back to the times when I first sat in front of a Soviet remake of a DEC PDP-11 with a duo-color CRT TTY -- except for Armageddon. But then, there will be hardly any machinery available if or when that happens.
« Last Edit: August 16, 2014, 03:42:39 AM by Mike Lobanovsky »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #458 on: August 16, 2014, 03:37:57 AM »
Rob,

Thanks a lot for your explanation on EQ?. So it evaluates not only pure similarity of their structure and data stuffing, but also implies complete identity of object instances being evaluated. In fact, it evaluates to TRUE only if it is one and the same memory object that these two different terms are referring to.

FBSL has a range of comparison operators to denote different "levels" of similarity of objects:

-- = checks for the equality of magnitudes;
-- == checks for the equality of both magnitudes and data types; and
-- Is checks if a given name references a given object.

So Is would be FBSL's closest analog to LISP's EQ?. Understood.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #459 on: August 16, 2014, 03:56:50 AM »
And Rob,

I would also like to know exactly why newlisp.dll is so fast to calc the fibonumbers. Is it because your iterative algo is mathematically (i.e. conceptually) so much faster than the recursive algorithm that we're using for our tests?

JRS

  • Guest
Re: Lisp in Basic
« Reply #460 on: August 16, 2014, 09:02:14 AM »
Quote
Running a console in Windows is like "driving" a Bentley that's tied to a horse's tail.

I agree! The Windows console experience is pitiful. Linux is much better in that area. If I wasn't a software developer, I would be a click & touch person as well. I could use the MySQL console interface which is a traditional way for creating and maintaining a DB. I prefer phpMyAdmin and will go through the extra effort of setting up an Apache server just for that feature alone. We all have our own way of defining comfortable.

XBLisp - The only scriptable (see JRS dictiionary) Lisp interpreter you can customize to fit your needs.

« Last Edit: August 16, 2014, 10:00:13 AM by John »

Charles Pegge

  • Guest
Re: Lisp in Basic
« Reply #461 on: August 16, 2014, 10:14:33 AM »
Windows Console? :)


Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #462 on: August 16, 2014, 10:16:45 AM »
Quote
... a console Tetris or Space Invaders ...

... or something yet less demanding e.g. like this little thingy.

That's your special to work out your fingers in the Windows console. Left/Right arrows to play, Escape to exit. :)


Quote
Windows Console? :)

Haha, exactly! ;D


.

JRS

  • Guest
Re: Lisp in Basic
« Reply #463 on: August 16, 2014, 10:34:45 AM »
Quote from: Charles
Windows Console?

I have the same feelings when using the 32 bit only line of Microsoft's premier 64 bit developer tools. PowerBASIC also followed this development trend. (16 bit patched DOS compiler generating hand crafted 32 bit (recently added) dead code removed binaries)

RobbeK

  • Guest
Re: Lisp in Basic
« Reply #464 on: August 16, 2014, 10:37:13 AM »
Hi Mike,

Yes ,  eq means the pointers have the same value -- however , all this stuff is somewhat a glimpse inside Pandora's box, some things may behave differently compiled versus interpreted --  to get warp speed CL sometimes makes a lot of copies of data in its memory ...   

Yes,  it's the iteration that gives it this speed -- the abstraction I used (not bad , I think )  is   Fib::(a b) -> (b a+b).

Those fib numbers have some strange characteristics -- tried something (attach)  :
When you square the Fib numbers and represent these by square surfaces, you can connect them so they can cover an infinite surface without any gaps  ...  ( c the demo --  oops another big file  ,  GCL in interpreted mode , slowed down a lot so one can see what's happening )

best Rob


.