1. Errors running script

Hi,

Please, consider this code:

-- Euphoria Code   
atom t0   
t0 = time() 
  
integer n = 10 
sequence b_lst = repeat( 1, n )   
sequence prime_lst = {}   
   
for prime = 2 to n do   
	if b_lst[prime] then   
		prime_lst = append(prime_lst, prime )   
		for i = prime * 2  to n by prime do   
			b_lst[i] = 0   
		end for   
	end if   
end for   
   
? prime_lst[$-9..$]   
? time() - t0  

When I try to run it, it returns two errors.

$ exu eratosthenes.eu  
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. 
eratosthenes.eu:5 
unknown command 
integer n = 10 
          ^ 
 
Press Enter 

I'm using version 3.1.1. The first error is ignored, seems a missing dependency.

Why is there an error in the line?

integer n = 10 
new topic     » topic index » view message » categorize

2. Re: Errors running script

Yes there is one. You need to declare a variable before the first assignations.

-- Euphoria Code    
atom t0 
integer n 
sequence b_lst, prime_lst 
 
t0 = time()  
... 

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

3. Re: Errors running script

There is another error:

? prime_lst[$-9..$]    

eratosthenes.eu:21 
slice lower index is less than 1 (-5)  

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

4. Re: Errors running script

With n = 10, you get only 4 primes, so you cannot show the ten last ones as you want to do.

You should use

? prime_lst 

instead of

? prime_lst[$-9..$]    

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

5. Re: Errors running script

lib9 said...

Hi,

Please, consider this code:

-- Euphoria Code   
atom t0   
t0 = time() 
  
integer n = 10 
sequence b_lst = repeat( 1, n )   
sequence prime_lst = {}   
   
for prime = 2 to n do   
	if b_lst[prime] then   
		prime_lst = append(prime_lst, prime )   
		for i = prime * 2  to n by prime do   
			b_lst[i] = 0   
		end for   
	end if   
end for   
   
? prime_lst[$-9..$]   
? time() - t0  

When I try to run it, it returns two errors.

$ exu eratosthenes.eu  
ERROR: ld.so: object 'libgtk3-nocsd.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. 
eratosthenes.eu:5 
unknown command 
integer n = 10 
          ^ 
 
Press Enter 

I'm using version 3.1.1. The first error is ignored, seems a missing dependency.

Why is there an error in the line?

integer n = 10 

Hi if you are using Eu 3.1.1 then you cannot assign a variable at declaration, but if you are using Eu 4.x hen you can.

So in Eu 3, integer n = 10 is illegal but in eu 4 integer n = 10 is legal.

Just wanted to clarify that a bit.

Incidentally, why are you using Eu 3.1.1?

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

6. Re: Errors running script

After fixing the minor errors:

-- Euphoria Code    
atom t0    
t0 = time()  
   
integer n  
n = 10  
 
sequence b_lst  
b_lst = repeat( 1, n )    
 
sequence prime_lst  
prime_lst = {}    
    
for prime = 2 to n do    
	if b_lst[prime] then    
		prime_lst = append(prime_lst, prime )    
		for i = prime * 2  to n by prime do    
			b_lst[i] = 0    
		end for    
	end if    
end for    
    
? prime_lst    
? time() - t0   

The original error you got was from ld.so, not Euphoria.

libgtk3-nocsd.so.0 was a hack added to prevent the GTK developers from messing with the native look and feel of the window managers on various platforms. It's no longer included in modern linux distros.

Running the corrected source code above with Euphoria 3.1.1 works fine, but compiling it on modern 64-bit Linux (Mint) results in the following error:

init-.c linking /usr/bin/ld: i386 architecture of input file `/home/irv/euphoria/bin/ecu.a(be_machine.o)' is incompatible with i386:x86-64 output

While there might be some kind of work-around to prevent this compile failure, just compiling the program using Euphoria 4.2 is a much better solution. It compiles and runs correctly.

You really should update to Eu 4.1 or 4.2, it has lots of improvements.

https://openeuphoria.org/wiki/view/DownloadEuphoria.wc

BTW, when I run this with n = 10, I get:

{2,3,5,7} 
0 

The linux time command for n = 10 gives:

{2,3,5,7} 
0 
 
real	0m0.004s 
user	0m0.001s 
sys	0m0.003s 
 

I had to change the line n = 10 to n = 20000 to get a non-0 sec runtime.

0.009999999776 
 
real	0m0.011s 
user	0m0.005s 
sys	0m0.006s 
 

new topic     » goto parent     » topic index » view message » categorize

7. Re: Errors running script

Ah, I've seen declaration and assignment in the same line before, the version of euphoria explains why 3.1.1 was complaining about it. Thank you.

new topic     » goto parent     » topic index » view message » categorize

8. Re: Errors running script

ChrisB said...

Incidentally, why are you using Eu 3.1.1?

Well, complexity is imposed in society in every way, also in the computing world. I'm moving to simpler solutions, that's why I revisited euphoria after some years. Maybe I can use it in some DOS distraction-free, fun context. I really miss a 64-bit modern DOS or at least some modern OS/2. I found FRANK that looks like a good and funny platform to use, so version 3.1.1 would fit the device.

There's also some revival of 3.1.1 in this site.

new topic     » goto parent     » topic index » view message » categorize

9. Re: Errors running script

ChrisB said...

Incidentally, why are you using Eu 3.1.1?

lib9 said...

Well, complexity is imposed in society in every way, also in the computing world. I'm moving to simpler solutions, that's why I revisited euphoria after some years.

Sounds good to me!

lib9 said...

Maybe I can use it in some DOS distraction-free, fun context.

Sadly, DOS was dropped in the later versions of OE (I don't remember it 4.0 had it but 4.2 certainly does not)

However, it may still work - as I alluded to here some years ago, https://openeuphoria.org/forum/m/134244.wc one of the open DOS communities from back then thought key could keep OE alive there by using something (I think it was the HX DOS Extneder) to run the w32 version of OE on DOS.

lib9 said...

I really miss a 64-bit modern DOS or at least some modern OS/2.

Well, vide-coded OSes are all the rage now. Might be a fun project.

lib9 said...

There's also some revival of 3.1.1 in this site.

This seems to be an even poorer version of what Shian already had seven years ago (as I reviewed in https://openeuphoria.org/forum/m/134244.wc - his old site seems to be gone now)

On the one hand, if it's his dream to launch a website about Eu 3.1.1 then I shouldn't really get in his way. But on the other hand, calling this a revival is a bit ... strong. A blog powered by (or at least full of posts made by) Gemini AI, but no forum .. so Shian has dropped the community. And I still don't see evidence of a repo or a place to make code updates and contribute fixes or improvements.

But perhaps that is the point - rather than reviving it, Shian Lee may simply want to preserve something frozen in a moment in time. It's a nice goal, like the Geocities archival projects.

new topic     » goto parent     » topic index » view message » categorize

10. Re: Errors running script

I'm not convinced that Eu 4 is any more "complex" in use than Eu 3 - the basics are the same.

It's just that with Eu 3, you had to write and debug your own routines to do common tasks, while many of those now come "stock" with Eu 4. You are free to ignore those, and write your own if you wish.

As for "plain DOS" - you can boot up Linux in plain text mode, and run 3.1 or 4.1 programs there. Eu 3.1 and 4.1 for Windows seem to work with Wine, as well, but why bother?

Much better, of course, is to run them in a terminal - which allows you to still have an open browser to check documentation, an editor, etc. all available right there on the screen as you work.

I use a terminal all the time when debugging GUI programs, see photo here: https://drive.google.com/file/d/1cZrkNUlxUUHICAHB7XHgKX2duOQO-R7q/view?usp=sharing

And of course the best Euphoria editor (IMHO) is also a GUI program: https://drive.google.com/file/d/1lXXrNleSwt4suxkcj53UZOgsanWFihNq/view?usp=sharing

new topic     » goto parent     » topic index » view message » categorize

11. Re: Errors running script

Eratosthene's calculation runs even on OOEU 1.9. I bound eu.ex with EU 3.1.1 bindu and OOEU runs on my LMDE Gigi.

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

12. Re: Errors running script

jmduro said...

Eratosthene's calculation runs even on OOEU 1.9. I bound eu.ex with EU 3.1.1 bindu and OOEU runs on my LMDE Gigi.

Jean-Marc

Hi Jean-Marc,

So many acronyms: OOEU, LMDE, Gigi, also bindu? Care to explain? Thank you.

new topic     » goto parent     » topic index » view message » categorize

13. Re: Errors running script

Hi lib9,

Sorry for the acronyms.

OOEU is Matthew Lewis' Object-Oriented Euphoria based on release 2.5 of Euphoria. Is is pure Euphoria.

LMDE is Linux Mint Debian Edition and Gigi is its last release based on Debian 13 Trixie.

bindu is the Linux binder of Euphoria 3.1.1. I Used it to get an executable of OOEU's interpreter because it didn't work on Linux with the Euphoria 2.5 binder.

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu