Raspberry BASIC

Recent Posts

Pages: 1 ... 8 9 [10]
91
Programming Challenges / Re: SALC Rasbian 32
« Last post by John Spikowski on December 11, 2019, 06:29:50 PM »
8th Update (Jalih submission)

Code: Text
  1. 1000000 constant LIMIT
  2.  
  3. a:new 0 a:push var, a
  4. 0 b:new true b:writable var, s
  5. 0 b:new true b:writable var, t
  6.  
  7.  
  8. : iterate
  9.   s @ "" 2 pick n:1- 26 n:mod 65 n:+ s:+ b:append
  10.   b:len 26 n:< not if
  11.     t @ swap b:append drop
  12.     0 b:new true b:writable s !
  13.   else
  14.     drop
  15.   then
  16.   a:push ;
  17.  
  18. : app:main
  19.   a @ ' iterate 1 LIMIT loop
  20.   t @ b:rev >s s:len "r LEN: %d\n" s:strfmt .
  21.   dup 26 s:lsub "Front: %s\n" s:strfmt .
  22.   26 s:rsub "Back:  %s\n" s:strfmt .
  23.   LIMIT a:@ nip "UBVal: %d\n" s:strfmt .
  24.   bye ;
  25.  


pi@RPi4B:~/8th-dev/examples $ timex ./1mil3-2
r LEN: 999986
Front: ZYXWVUTSRQPONMLKJIHGFEDCBA
Back:  ZYXWVUTSRQPONMLKJIHGFEDCBA
UBVal: 1000000
2.09user 0.16system 0:02.28elapsed 99%CPU (0avgtext+0avgdata 53140maxresident)k
0inputs+0outputs (0major+12124minor)pagefaults 0swaps
pi@RPi4B:~/8th-dev/examples $


I thought Rust executables were huge. 8th takes the lead in this category.

-rwxr-xr-x 1 pi pi 7344807 Dec  9 21:02 1mil3-2
92
Nim / Nim SB
« Last post by John Spikowski on December 11, 2019, 05:38:36 PM »
I'm working on embedding ScriptBasic into Nim. Basically it's a port of the SBT extension module as Nim extension. This will allow the full functionality of SB and its extensions to be available to Nim dynamically at runtime.

@AIR - I may need some help creating the Nim interface if you have time.
93
Nim / Re: Nim Introduction
« Last post by John Spikowski on December 11, 2019, 06:59:30 AM »
Yep. On the regret list. I should have listened to you years ago.

I hope to become as proficient with Nim as I am with SB.

My next example with Nim will be embedding ScriptBasic. It will be like a high level EVAL function. You pass it some SB code as text and it returns what you want from it. I don't want to leave my old friend behind. Actually this is what ScriptBasic was designed for, not a standalone BASIC interpreter

94
Swift / Re: Swift RPi
« Last post by AIR on December 11, 2019, 06:31:06 AM »
That's in line with what I'm seeing on my Mac, using the official Apple Swift.

AIR.
95
Nim / Re: Nim IUP
« Last post by AIR on December 11, 2019, 06:22:18 AM »
Took you a while, but I'm glad you're finally taking NIM for a spin!

AIR.
96
Swift / Re: Swift RPi
« Last post by John Spikowski on December 11, 2019, 01:56:07 AM »
I tried the latest submission for Swift on my laptop Ubuntu 19.10 64 bit. It looks to me that  the problem is specific to ARM. I typically see a 4-5 X speed difference between my Lenovo laptop and the RPi 4B 4GB.


ubuntu@ubuntu:~/swift-dev/examples$ /usr/bin/time ./main
t LEN:  999986
Front: ZYXWVUTSRQPONMLKJIHGFEDCBA
Back:  ZYXWVUTSRQPONMLKJIHGFEDCBA
UBVal:  100000
0.19user 0.01system 0:00.23elapsed 91%CPU (0avgtext+0avgdata 16868maxresident)k
10264inputs+24outputs (31major+2804minor)pagefaults 0swaps
ubuntu@ubuntu:~/swift-dev/examples$ time ./main
t LEN:  999986
Front: ZYXWVUTSRQPONMLKJIHGFEDCBA
Back:  ZYXWVUTSRQPONMLKJIHGFEDCBA
UBVal:  100000

real   0m0.227s
user   0m0.210s
sys   0m0.016s
ubuntu@ubuntu:~/swift-dev/examples$

97
General Discussion / Re: RPI Forum
« Last post by John Spikowski on December 10, 2019, 11:32:01 PM »
The Swift ARM maintainer agrees there is a problem with the Swift string engine. I hope he follows up with it. I've done all I can.
98
General Discussion / Re: MS Rust
« Last post by AIR on December 10, 2019, 11:08:44 PM »
Will it be using IL or will it be a more direct (meaning no intermediate or JIT compiling steps like some Dot Net languages) to binary solution?

AIR.
99
General Discussion / Re: RPI Forum
« Last post by AIR on December 10, 2019, 11:00:09 PM »
In the case of Swift, it's more about how quickly/easily you can implement a solution to a task rather than how fast that implementation will run.  Considering that it caters to quickly being able to put something together for I-devices, I guess it's a fair tradeoff.

AIR.
100
Programming Challenges / Re: SALC Rasbian 32
« Last post by John Spikowski on December 10, 2019, 06:49:19 AM »
Free Pascal (AIR submission)

Code: Pascal
  1. // Free Pascal -1mil3 - AIR
  2.  
  3. program mil;
  4.  
  5. Uses StrUtils;
  6.  
  7. var
  8.     s:AnsiString;
  9.     t:AnsiString;
  10.     c:AnsiChar;
  11.     a:array[0..1000001] of int32;
  12.     x:int32;
  13. begin
  14.     s := '';
  15.     t := '';
  16.     for x := 0 to 1000001 do
  17.     begin
  18.         c :=  chr( (x mod 26)+65 );
  19.         a[x] := x;
  20.         s += c;
  21.         if Length(s) = 26 then
  22.         begin
  23.             t += ReverseString(s);
  24.             s := '';
  25.         end;
  26.     end;
  27.  
  28.     writeln( 'r len: ', Length(t) );
  29.     writeln( 'Front: ', LeftStr(t,26) );
  30.     writeln( 'Back:  ', RightStr(t,26) );
  31.     writeln( 'UBVal: ', a[1000000]);
  32. end.
  33.  


pi@RPi4B:~/freepascal-dev/examples $ ls -l
total 80
-rwxr-xr-x 1 pi pi 78352 Dec  9 20:31 1mil3
pi@RPi4B:~/freepascal-dev/examples $ timex ./1mil3
r len: 999986
Front: ZYXWVUTSRQPONMLKJIHGFEDCBA
Back:  ZYXWVUTSRQPONMLKJIHGFEDCBA
UBVal: 1000000
0.20user 0.02system 0:00.23elapsed 99%CPU (0avgtext+0avgdata 5604maxresident)k
8inputs+0outputs (0major+1431minor)pagefaults 0swaps
pi@RPi4B:~/freepascal-dev/examples $

Pages: 1 ... 8 9 [10]