Author Topic: Lisp in Basic  (Read 208382 times)

0 Members and 5 Guests are viewing this topic.

JRS

  • Guest
Re: Lisp in Basic
« Reply #525 on: August 18, 2014, 10:44:29 AM »
All sounds good to me.

The reason I removed Arthur's comments was they were getting in the way with the restructure. The plans were a new code documentation effort after the dust settled. Maybe you could add WIP comments to the code in this form or something like it so they are easy to find later.

Code: [Select]
' <Mike>  ....

@Rob - Can you declare up front what Lisp project your response is addressing? Personally I only have enough mental capacity to deal with SBLisp and maybe a little left over to experiment with C BASIC and the SDL_gfx / ECL libraries under Linux 64 bit. Thanks again for helping out with these pooled resource projects.
« Last Edit: August 18, 2014, 11:15:57 AM by John »

RobbeK

  • Guest
Re: Lisp in Basic
« Reply #526 on: August 18, 2014, 01:03:30 PM »
Hi John, Mike ..

A little sample -- the Mandel tomorrow (but the speed is very low -- need a few tests for the console output -- this Lisp has no strings  ??? )

@Mike -- is their an exit function ? I have completely to close my console to start over again (it refuses redefinitions - and the exe does not run in REPL mode under LispIDE ).

@John - Lisp project ?  ( the job ? - i wrote interfaces between AutoDesk's AutoCAD and Siemens CAD/CAM machinery -- but in the end I coded the complete designing from the start too -- everything running under MS DOS/Lisp   8)   - to be honnest, I sometimes uses Basic-scripts too , (but these can not reach the entities of AutoCAD's database system in depth - Lisp can ! )
I'm busy with Bigloo Scheme now, writing the Mandelbrot can be done in 15' -- if this helps ??

attach --  it loads and runs --  tried the magical mapping , it's slow - but works , feels like being in the 1970s again ...   ;)

best Rob



.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #527 on: August 18, 2014, 01:06:03 PM »
John,

1. Rob's last message but one regards XBLisp and concerns the instruments (user-defined procedures a.k.a. lambdas) that will help him re-create in XBLisp the BASIC ASCII Mandelbrot which I sent him yesterday. Such lambdas are available in Scheme in the form of library procedures outside the scope of its basic vocabulary. So we agreed to keep them in a separate lib.lisp file either loadable before an interactive session or includable at the beginning of a .lisp file with a (load 'lib.lisp) directive.

2. I've finished my work for today -- I got too tired and inattentive.

3. I did't add the multi-file load option yet. I think we can live without it for now because files can be added to other files in the form of includes as described in Item 1 above.

4. I succeeded in splitting the main parts of XBLisp entirely and the script should be fully working now. At least it works for me here. The only place where GoSub's still stay is the large LispEval() procedure that starts somewhere in the middle of the file. These GoSub's are entirely intrinsic to LispEval() and can be turned into standalone Function's very easily. They aren't referenced anywhere else except within LispEval() itself.

5. This code will stay compatible with OxyLISP. ;)

6. I have optimized IF conditionals wherever possible to speed up evaluation a little.

7. Please do not try to re-arrange the code (it is position-dependent) nor re-write the remaining GoSub's into Function's yourself. You don't have a clear idea yet of how error propagation from deeply nested recursion works so you may break it easily. Let me finish it off myself tomorrow.

8. Please recompile a new 32-bit SBLisp.exe and post it here for Rob and me to use in our future tests.

9. I will label my comments in accordance with your suggestion tomorrow. Apart from that, formating should be compliant with your requirements.

Thank you. I hope you'll like the results.

[EDIT] Attachment deleted due to a Linux bug
« Last Edit: August 18, 2014, 07:37:34 PM by Mike Lobanovsky »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #528 on: August 18, 2014, 01:09:12 PM »
Rob,

1. The exit function is (quit). Everything is described in the PDF file. Have you got it? Alternatively, SBLisp.exe will break on ^C (Ctrl+C) allowing you to exit but keep the console open.

2. No, redefinitions aren't allowed.

3. Please wait till John posts shortly a new SBLisp.exe here on the forum for you and me to use.

Thanks! :)


P.S. I'LL BE DAMNED! YOUR PROGRAM WORKS! :D

You may use a -D switch in your command line -- it will then show when and how garbage collection works. It will make the script run subjectively "faster". -D stands for debug mode.

P.P.S. And pretend you're working on a Sinclair. :D

P.P.P.S. You may try to enter a "string" like this: '"this is a multiword string with spaces" (mind the leading apostrophe!). It will go into the hash table as SYMBOL though, so I don't know yet if it is of any use anywhere but a (print) statement. :(
« Last Edit: August 18, 2014, 01:43:45 PM by Mike Lobanovsky »

RobbeK

  • Guest
Re: Lisp in Basic
« Reply #529 on: August 18, 2014, 01:40:25 PM »
Thanks Mike,  !!   (4 the tips)

(quit)  ok !      yes, i have the pdf -- but only tried the classics     (bye) (by) & (exit)   ???

Sinclair --   well , I had the ZX-81 and the QL  (and answering Aurel's question , they had a Lisp, but it was not written in Basic )

best , Rob

JRS

  • Guest
Re: Lisp in Basic
« Reply #530 on: August 18, 2014, 01:59:41 PM »
Bitbucket updated with Mike's current SBLisp.

@Rob - If you ever get bored with us, here is something to ponder. LispOS  :o


« Last Edit: August 18, 2014, 02:20:59 PM by John »

JRS

  • Guest
Re: Lisp in Basic
« Reply #531 on: August 18, 2014, 02:26:20 PM »
Not here.  :-\

Code: [Select]
jrs@laptop:~/sb/sb22/sblisp$ scriba lisp.sb Xblisp002.txt
SBLisp - Scheme BASIC Lisp

(define divisor?
  (lambda (p q)
ERROR: Read.
ERROR: Problem in file Xblisp002.txt
ERROR: Bad type.
0]

Looks the same with my version before Mike's changes.

Code: [Select]
jrs@laptop:~/sb/sb22/sblisp$ scriba lisp_gold.sb Xblisp002.txt
SBLisp - Scheme BASIC Lisp

(define divisor?
  (lambda (p q)
ERROR: Read.
ERROR: Problem in file Xblisp002.txt
0]
« Last Edit: August 18, 2014, 02:45:51 PM by John »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #532 on: August 18, 2014, 02:52:00 PM »
 :o !

Are you absolutely sure you haven't changed a single line in my script? Are you absolutely sure you haven't tried to merge some of your untested mods with my script?

Please try to compile a 32-bit SBLisp.exe from my verbatim source and see what happens in your Windows and/or Wine.

I have absolutely no PB here (my file was just renamed to rob2.lisp):

(going to check it in WoW64 under my Win 7 now... rebooting...)

.

JRS

  • Guest
Re: Lisp in Basic
« Reply #533 on: August 18, 2014, 02:57:39 PM »
I'm using your copy of SBLisp and even tried it with my old version. (see above) You can verify what I'm running by the source on Bitbucket.

Runs fine under Wine.

Code: [Select]
SBLISP
------

LIST=(2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
297 298 299)

FILTERING_PRIMES_BY_MAPPING
(2 3 0 5 0 7 0 0 0 11 0 13 0 0 0 17 0 19 0 0 0 23 0 0 0 0 0 29 0 31 0 0 0 0 0 37 0 0 0 41 0 43 0 0 0 47 0 0 0 0 0 53 0 0 0 0 0 59 0 61 0 0 0 0 0 67 0 0 0 71 0 73 0 0 0 0 0 79 0 0 0
 83 0 0 0 0 0 89 0 0 0 0 0 0 0 97 0 0 0 101 0 103 0 0 0 107 0 109 0 0 0 113 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 131 0 0 0 0 0 137 0 139 0 0 0 0 0 0 0 0 0 149 0 151 0 0 0 0 0 157 0
0 0 0 0 163 0 0 0 167 0 0 0 0 0 173 0 0 0 0 0 179 0 181 0 0 0 0 0 0 0 0 0 191 0 193 0 0 0 197 0 199 0 0 0 0 0 0 0 0 0 0 0 211 0 0 0 0 0 0 0 0 0 0 0 223 0 0 0 227 0 229 0 0 0 233 0
0 0 0 0 239 0 241 0 0 0 0 0 0 0 0 0 251 0 0 0 0 0 257 0 0 0 0 0 263 0 0 0 0 0 269 0 271 0 0 0 0 0 277 0 0 0 281 0 283 0 0 0 0 0 0 0 0 0 293 0 0 0 0 0 0)
....FINISHED..........
T
0]

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #534 on: August 18, 2014, 03:07:32 PM »
John,

I confirm it runs perfectly fine for me with both 32-bit scriba.exe and 64-bit sb64.exe under Windows 7.

Please find the initialization of flag badluck = 666 and change it to, say, badluck = 100 and see if it works in Linux...

JRS

  • Guest
Re: Lisp in Basic
« Reply #535 on: August 18, 2014, 03:17:18 PM »
Quote from: mike
Please find the initialization of flag badluck = 666 and change it to, say, badluck = 100 and see if it works in Linux...

That's cruel!  :-[

Did I forget to mention how happy I am with the color syntax highlight with Ultra Edit on Linux?   ;D

Seriously. I have a solution so you can try this. I will copy the current SBLisp to Koding.com (Ubuntu 64 bit) and you can see it for yourself. If you don't have a FREE account already, (no info other than a valid e-mail needed) than I will send you my login info.

.
« Last Edit: August 18, 2014, 03:35:43 PM by John »

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #536 on: August 18, 2014, 03:36:04 PM »
Back to XP (I have so many more useful tools installed here...)

WinMerge shows absolutely no difference between my script and the repo except i) mine has double quotes around error.bas and ii) mine has Windows standard 0xD+0xA line breaks against 0xA-only Linux linefeeds in the repo. But it should be normal as it was me that saved the respective files in that way.

Hmmmm... Tell me please if you can compile me a standalone executable 32-bit scriba file without non-system dependencies or config file for Linux? I prefer to work offline. If yes then where and how should I put it to be able to run lisp.sb in my local Linux installations?

Now please try to load Rob's file manually. Start scriba lisp.sb then manually type in (load 'Xblisp002.txt) to see what happens. Also be forewarned, hehe again, that Rob's file has Windows linebreaks in it.

« Last Edit: August 18, 2014, 03:42:59 PM by Mike Lobanovsky »

JRS

  • Guest
Re: Lisp in Basic
« Reply #537 on: August 18, 2014, 03:38:19 PM »
I have a Ubuntu 32 bit VirtualBox I could try it in.

Mike Lobanovsky

  • Guest
Re: Lisp in Basic
« Reply #538 on: August 18, 2014, 03:44:44 PM »
Please do. Can you both compile and try or try only? (be sure to read my previous message with mods)

JRS

  • Guest
Re: Lisp in Basic
« Reply #539 on: August 18, 2014, 03:46:00 PM »
Nope. Doesn't work on Ubuntu 32 bit either.

Code: [Select]
jrs@U32VB:~/sb22/sblisp$ ../bin/scriba lisp.sb Xblisp002.txt
SBLisp - Scheme BASIC Lisp

(define divisor?
  (lambda (p q)
ERROR: Read.
ERROR: Problem in file Xblisp002.txt
ERROR: Bad type.
0]

FWIW - (fibonacci 24) works on Ubuntu 64 bit.