Author Topic: Notes on Script BASIC  (Read 30140 times)

Aurel

  • Guest
Re: Notes on Script BASIC
« Reply #30 on: September 22, 2018, 11:03:43 AM »
The old story  :)
Tomas loves to convey himself as an expert for every programming language
and in fact he is a common miser who thinks he knows something.

oups he is very good copy/paste programmer. ;D ;D ;D

Tomaaz

  • Guest
Re: Notes on Script BASIC
« Reply #31 on: September 22, 2018, 01:19:33 PM »
  • ScriptBasic's current state: it is not actively being maintained anymore by the original developer, Peter Verhas, whose presence in the project would guarantee a high quality implementation

For me, that's the main issue. ScriptBasic seems unfinished. John is doing good job, but it's not a replacement for a proper development.

As for the newLisp GUI, I also was disappointed that it started to use a Java-based GUI, a decision made some time ago. I am not saying that it should have been GTK, but come on... Java?!?! Really?!?!  ??? 

Good to know it's not only me.  ;)

The old story  :)
Tomas loves to convey himself as an expert for every programming language
and in fact he is a common miser who thinks he knows something.

Considering the fact that I've just admitted my Lisp skills being rather poor, what are you talking about? For your information:
  • I know almost nothing about programming in Go, Java, C, C++ or Pascal
  • I know absolutely nothing about C#, Haskel, Rust, F, Swift, Kotlin, Fortran and hundreds of other languages

Please, update your database and next time, when you want to say something about me, use an up to date information (and a correct spelling of my name). Also, you forgot to mention two other things I'm very good at - configuring Geany and heavy vodka drinking.  ;D

B+

  • Guest
Re: Notes on Script BASIC
« Reply #32 on: September 22, 2018, 02:19:36 PM »
Uh! because Script ASIC doesn't structure variables the same as other PL's doesn't mean it couldn't produce same results in one elegant line, just needs some setup.

For example QB64 has next to nothing for array handling, I had to build a library just to sort an array of floats and some other tools for handling number arrays but I had all tools to make a function that does same as these built-ins of PL's you are showing off.

Code: [Select]
'Test Floats Array Tools Library.bas for QB64
PRINT UniqueSortSlice$("120 135 345 345 1890 12 120 12 135 712 78 120", "descend", 0, 3) 'Tomaaz sample
PRINT UniqueSortSlice$("120 135 345 345 1890 12 120 12 135 712 78 120", "ascend", -10, 5) 'test join tolerance
PRINT UniqueSortSlice$("120 135 345 345 1890 12 120 12 135 712 78 120", "descend", 3, 16)
PRINT UniqueSortSlice$("1 1.1 1.11 1.1 1.11 1. 1.0 1.111 .999999999999999999999999999999999999999", "ascend", 0, 1000) 'oh that's nice!!! but I think .99... is same as 1

FUNCTION UniqueSortSlice$ (NumberStr$, ascendDescend$, SliceStart AS LONG, SliceEnd AS LONG)
    REDIM temp(0) AS _FLOAT
    Split2Floats NumberStr$, " ", temp()
    uniqueFloats temp()
    qSortFloats LBOUND(temp), UBOUND(temp), temp()
    IF ascendDescend$ <> "ascend" THEN reverseFloats temp()
    UniqueSortSlice$ = JoinFloats$(temp(), SliceStart, SliceEnd, " ")
END FUNCTION

'$include: 'Floats Array Tools.bm'

See attached output. It would have been easier with Script Basic or with SmallBASIC because both use variant variable types and more advanced array stuff is already built into language.


« Last Edit: September 23, 2018, 03:05:05 AM by B+ »

Tomaaz

  • Guest
Re: Notes on Script BASIC
« Reply #33 on: September 22, 2018, 02:39:47 PM »
Well, if you build yourself a special library dedicated to that task then you can have a one-liner in any language, but that's not the point. The point is that in Python things like that are ready to use out of the box. That was just a very basic example. You can create more complex examples and then what? Are you gonna create a special library for each of them?


B+

  • Guest
Re: Notes on Script BASIC
« Reply #34 on: September 22, 2018, 02:42:55 PM »
I built a special library to handle float arrays the same as you are showing, as strings$

I did build a special function because QB64 sucks as far as not being able to pass arrays through functions, not same problem with Script or SmallBASIC.

How hard is it to change your output to this? (attached)

And how do these things handle floats? The forth line? I am curious the decision it would make for 1, 1.0, 1. and .99.... would they be the same or each unique?



« Last Edit: September 22, 2018, 02:51:23 PM by B+ »

Tomaaz

  • Guest
Re: Notes on Script BASIC
« Reply #35 on: September 22, 2018, 03:48:49 PM »
OK. Here is another task. Recursively walk directory, find all .jpg files which names are integers, sort the names by numbers and print the result.

Ruby (one line):
Code: [Select]
puts Dir.glob("**/*").select{|a| File.extname(a) == ".jpg" and File.basename(a, ".jpg").to_i.to_s == File.basename(a, ".jpg")}.map {|a| File.basename(a, ".jpg").to_i}.sort

If you want to know what part of the code is responsible for what part of the task, I can explain it to you. It only looks cryptic. If you know basics of Ruby it's clear as
Code: [Select]
for x = 1 to 10 : print x : next x in BASIC.  ;)

Mike Lobanovsky

  • Guest
Re: Notes on Script BASIC
« Reply #36 on: September 22, 2018, 07:58:01 PM »
Look guys,

What are those Python/Ruby/QB64/younameit "tasks" doing in the Notes on Script BASIC thread in the absence of the language project lead?

Is the forum Administration really after the ever increasing message counter readings by way of blatant trolling and flooding in every other thread on a BASIC forum?!

(Tomaaz, should BASICs be able to swallow LISP-ish lists and maps, they would've been called LISPs. Or Pythons at the worst. This is definitely not what the BASIC community is particularly after -- here or elsewhere.)

Tomaaz

  • Guest
Re: Notes on Script BASIC
« Reply #37 on: September 22, 2018, 09:58:39 PM »
Mike, you were away writing next "Smoke on The Water" or next "Child in Time", so let me explain what's happened here. John kept spamming every possible topic and asking me and B+ what was that we didn't like about ScriptBasic. In response to that, B+ has started this topic and we have both given John our answers. B+ doesn't like the fact that ScriptBasic is not beginner friendly, I don't like the fact that it's unfinished and, despite what John's saying, it can't compete with serious scripting languages (my examples are here to prove it). John, instead of agreeing/disagreeing with us, has closed his account. I agree that there was "trolling and flooding in every other thread", but, sorry, it wasn't me or B+.

As for "lists and maps", they are part of any serious scripting language. You can find them in Python, Perl, Ruby, Tcl, PHP, JavaScript. Does it make Perl Python? Should we call Ruby "PHP"? Or maybe we should call PHP "Ruby"? How come NewLisp looks completely different than Tcl? They both have "lists and maps". For me, BASIC doesn't have to have these features. It would be nice if it had, but it's not necessary. After all, BASIC is meant to be a simple language for beginners. You just need to understand that it's not as powerful and flexible language as Python, Ruby or Perl. It doesn't have to be a bad thing, either. But you need to see that difference. And this is something John finds difficult to accept. He keeps describing ScriptBasic as this great, professional BASIC that is a real programming language (as oppose to the toy languages developed by other members here) and expects every single BASIC user and developer to share his enthusiasm and quit any other languages they happen to be using/developing. Well, it will never happen. I wish John didn't quit (I really struggle to find reason for it), but he's gone, so does it really matter what we're posting in this topic?

« Last Edit: September 22, 2018, 10:00:12 PM by Tomaaz »

Mike Lobanovsky

  • Guest
Re: Notes on Script BASIC
« Reply #38 on: September 22, 2018, 10:27:36 PM »
Smoke on the Water and Child in Time are unique phenomena in the hard rock culture and as such cannot be replicated or rivaled. ;D

Thanks for bringing me up to date with the cause of events in this thread. I must confess it was a little difficult for me to reconstruct it with some of John's responses evidently missing. Yet if I were in your shoes I'd most likely stop posting here and would rather open a couple of new threads to present the Python/Ruby examples as challenges for the BASIC-ers to compete. It's obvious there won't be a Script BASIC solution to them anyway though...

Tomaaz

  • Guest
Re: Notes on Script BASIC
« Reply #39 on: September 22, 2018, 11:01:45 PM »
Smoke on the Water and Child in Time are unique phenomena in the hard rock culture and as such cannot be replicated or rivaled. ;D

Ritchie Blackmore in Child in Time - one of the greatest guitar solos in history (especially in the original version from In Rock). You see - it was still possible to achieve a higher level of off-topic.  ;D

B+

  • Guest
Re: Notes on Script BASIC
« Reply #40 on: September 23, 2018, 03:25:28 AM »
Uh! because Script ASIC doesn't structure variables the same as other PL's doesn't mean it couldn't produce same results in one elegant line, just needs some setup.

For example QB64 has next to nothing for array handling, I had to build a library just to sort an array of floats and some other tools for handling number arrays but I had all tools to make a function that does same as these built-ins of PL's you are showing off.

Code: [Select]
'Test Floats Array Tools Library.bas for QB64
PRINT UniqueSortSlice$("120 135 345 345 1890 12 120 12 135 712 78 120", "descend", 0, 3) 'Tomaaz sample
PRINT UniqueSortSlice$("120 135 345 345 1890 12 120 12 135 712 78 120", "ascend", -10, 5) 'test join tolerance
PRINT UniqueSortSlice$("120 135 345 345 1890 12 120 12 135 712 78 120", "descend", 3, 16)
PRINT UniqueSortSlice$("1 1.1 1.11 1.1 1.11 1. 1.0 1.111 .999999999999999999999999999999999999999", "ascend", 0, 1000) 'oh that's nice!!! but I think .99... is same as 1

FUNCTION UniqueSortSlice$ (NumberStr$, ascendDescend$, SliceStart AS LONG, SliceEnd AS LONG)
    REDIM temp(0) AS _FLOAT
    Split2Floats NumberStr$, " ", temp()
    uniqueFloats temp()
    qSortFloats LBOUND(temp), UBOUND(temp), temp()
    IF ascendDescend$ <> "ascend" THEN reverseFloats temp()
    UniqueSortSlice$ = JoinFloats$(temp(), SliceStart, SliceEnd, " ")
END FUNCTION

'$include: 'Floats Array Tools.bm'

See attached output. It would have been easier with Script Basic or with SmallBASIC because both use variant variable types and more advanced array stuff is already built into language.


How can the above possibly be construed as advocating QB64?

I thought I was defending the SB's for their variant type variables and advanced array manipulation over and above QB64 in that one department.

I thought I was demonstrating that even QB64 can do what Tomaaz was doing though it takes a few or many more lines.

So to be clear to everyone named Mike that is what I was attempting to do.

Here is the last line of the quote once again, in John's style:
See attached output. It would have been easier with Script Basic or with SmallBASIC because both use variant variable types and more advanced array stuff is already built into language.
« Last Edit: September 23, 2018, 03:29:46 AM by B+ »

B+

  • Guest
Re: Notes on Script BASIC
« Reply #41 on: September 23, 2018, 03:46:06 AM »
I built a special library to handle float arrays the same as you are showing, as strings$

I did build a special function because QB64 sucks as far as not being able to pass arrays through functions, not same problem with Script or SmallBASIC.

How hard is it to change your output to this? (attached)

And how do these things handle floats? The forth line? I am curious the decision it would make for 1, 1.0, 1. and .99.... would they be the same or each unique?

Tomaaz,

I am inquiring about how the language you are advocating handles a couple of things, did you miss it?

You didn't just setup a more difficult task to blow off my question did you?

And yes, I agree new tasks should go in a different board.

They really don't belong here, just the answer to my question. ;)

PS the library is not special for your task, it is a general set of useful tools for handling Float Arrays. Sure, they may come in handy in future dealings with Tomaaz Tasks. :)
« Last Edit: September 23, 2018, 03:51:51 AM by B+ »

Peter

  • Guest
Re: Notes on Script BASIC
« Reply #42 on: September 23, 2018, 08:02:21 AM »
OK. Here is another task. Recursively walk directory, find all .jpg files which names are integers, sort the names by numbers and print the result.

I know why you proposed this task, and my code below is completely off-topic, but I simply couldn't resist solving this  :) I am interested to see how it looks in other BASIC variants.

Code: [Select]
SUB Recurse_Dir(STRING dir$)
    LOCAL here TYPE DIR*
    OPEN dir$ FOR DIRECTORY AS here
    WHILE TRUE
        GETFILE item$ FROM here
        IF NOT(LEN(item$)) THEN BREAK
        IF item$ = "." OR item$ = ".." THEN CONTINUE
        new$ = dir$ & "/" & item$
        IF FILETYPE(new$) = 2 THEN
            Recurse_Dir(new$)
        ELSE
            IF BASENAME$(new$, 2) = "jpg" AND REGEX(BASENAME$(new$, 1), "^[[:digit:]]*$") THEN result$ = APPEND$(result$, 0, new$, NL$)
        END IF
    WEND
    CLOSE DIRECTORY here
END SUB
Recurse_Dir(".")
PRINT SORT$(result$, NL$)

Yet if I were in your shoes I'd most likely stop posting here and would rather open a couple of new threads to present the Python/Ruby examples as challenges for the BASIC-ers to compete.

That is a great idea! It would stimulate improving implementations of BASIC.
« Last Edit: September 23, 2018, 08:12:38 AM by Peter »

Tomaaz

  • Guest
Re: Notes on Script BASIC
« Reply #43 on: September 23, 2018, 02:39:32 PM »
Yes, that would be great, but I seriously doub " the WinApi guru" will let us do it. He's already declared Python, Perl, Ruby etc. to be "junk",  OOP to be " useles" and https to be "just another crap". When he sees my nickname together with the word " Python" in one post,  it's the end of serious discussion (this topic is a perfect example).

B+

  • Guest
Re: Notes on Script BASIC
« Reply #44 on: September 23, 2018, 02:47:55 PM »
Yes, that would be great, but I seriously doub " the WinApi guru" will let us do it. He's already declared Python, Perl, Ruby etc. to be "junk",  OOP to be " useles" and https to be "just another crap". When he sees my nickname together with the word " Python" in one post,  it's the end of serious discussion (this topic is a perfect example).

Yeah sure blame it on him. (Though it's definitely more than partly true, you love it.) I had a serious question, is it being ignored?

PS I am eager to try an SB out on this latest challenge, will someone please post something in another thread or do I have to do it again?
« Last Edit: September 23, 2018, 02:53:22 PM by B+ »