seed7-users Mailing List for Seed7 (Page 2)
Interpreter and compiler for the Seed7 programming language.
Brought to you by:
thomas_mertes
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
|
Feb
(9) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(4) |
Aug
|
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2011 |
Jan
(2) |
Feb
|
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
(2) |
Aug
(6) |
Sep
(7) |
Oct
(3) |
Nov
(10) |
Dec
(4) |
2013 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(1) |
Dec
(1) |
2015 |
Jan
(2) |
Feb
(2) |
Mar
(2) |
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2016 |
Jan
|
Feb
(3) |
Mar
(2) |
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(3) |
Dec
(3) |
2021 |
Jan
(2) |
Feb
(6) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(12) |
Oct
(4) |
Nov
(17) |
Dec
(3) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(2) |
May
|
Jun
(17) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
2024 |
Jan
|
Feb
(5) |
Mar
(7) |
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
(12) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2025 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Zachary M. <za...@ma...> - 2024-03-12 17:51:18
|
Hey Thomas, I was just installing Seed7 version 2024-03-01 on a Windows OS, but I encountered three errors when running mingw32-make depend after I had copied the "mk_mingw.mak" over the "makefile": First was "base.h" couldn't be found: gcc chkccomp.c -o chkccomp chkccomp.c:28:10: fatal error: base.h: No such file or directory 28 | #include "base.h" | ^~~~~~~~ compilation terminated. mingw32-make: *** [makefile:274: chkccomp.exe] Error 1 Second was "chkccomp.h" couldn't be found. I circumvented those two by copying those files from my old version. Third was that the "chkccomp.exe" command was not found; which is strange because the file exists in the "src" directory. I'm not sure how to circumvent this error (does it think I'm on a Linux system, given the "/usr/bin/bash" reference?) gcc chkccomp.c -o chkccomp .\chkccomp.exe version.h "S7_LIB_DIR=" "SEED7_LIBRARY=" /usr/bin/bash: line 1: .chkccomp.exe: command not found mingw32-make: *** [makefile:270: version.h] Error 127 Zachary |
From: <med...@tu...> - 2024-02-07 15:40:18
|
Thomas, please ignore my previous message, I understand it now. Cheers, Joe -- Sent with Tuta; enjoy secure & ad-free emails: https://tuta.com 6 Feb 2024, 2:00 pm by tho...@gm...: > Hi Joe, > > Thank you for pointing out that sort was not documented. I have updated the documentation. > Now, the link to "sort" at https://seed7.sourceforge.net/manual/types.htm#array points to > https://seed7.sourceforge.net/libraries/array.htm#sort(in_arrayType) > > Tell me if this documentation is sufficient. > > Regards > Thomas > |
From: Thomas M. <tho...@gm...> - 2024-02-06 15:18:05
|
Hi Zachary, Regarding the changes in the makefile (see other post): You need to replace all occurrences of "drw_win" in the makefile (see other post) by "drw_gdip". Leave the file name extensions intact. E.g.: Replace "drw_win.c" by "drw_gdip.c" and "drw_win.o" by "drw_gdip.o" and "drw_win.obj" by "drw_gdip.obj". Best regards Thomas |
From: Thomas M. <tho...@gm...> - 2024-02-06 15:02:07
|
Hi Zachary, Sorry for the delay. Great that you are interested in writing a GDI+ graphics driver for Seed7. I started writing a GDI+ driver (drw_gdip.c) myself in 2023 but stopped soon. The problem is: It seems that X11 cannot support transparency with an alpha channel. There is support to draw windows with an arbitrary shape (not rectangular). But I did not find documentation about a general alpha channel. It could be that there is an extension to X11 that I am not aware of. So I cannot rule out that X11 can support an alpha channel. There are also OpenGL and Wayland and I guess that they could support an alpha channel. Unfortunate I have not Wayland driver at the moment and the OpenGL driver is not finished. It would be great if you would write a GDI+ driver (drw_gdip.c) for Seed7. And I would gladly add it as alternative driver to drw_win.c. But the alpha channel functionality can only be exposed to the user if there is a solution for all platforms. I will only support an alpha channel in Seed7 if it works on all platforms. In the moment I am working on a graphics library for the browser (see drw_emc.c, gkb_emc.c, emc_utl.c) which uses JavaScript. The JavaScript interface to graphics supports an alpha channel. If you convert an RGB value to a pixel value you get an ARGB pixel with ff at the highest 8 bits (meaning not transparent). Up to now the alpha channel functionality is not available from the Seed7 graphics API (this is on purpose to avoid unportable programs). As soon as all graphics drivers can handle an alpha channel I can add an official API for them. E.g.: A function that creates an ARGB pixel value from ALPHA, RED, GREEN and BLUE values. Regarding your question about using drw_gdip.c: If you want that the Seed7 compiler/interpreter uses the drw_gdip.c driver instead of drw_win.c you need to edit your makefile. Depending on the compiler you use (I assume under windows) this might be mk_mingw.mak (gcc), mk_mingc.mak (gcc from the seed7/gcc directory) mk_msvc.mak (cl from Visual Studio). If you copied some makefile to the name makefile (like I suggest in the documentation) you have to edit src/makefile. You can just replace all occurrences of drw_win.c in this makefile by drw_gdip.c. you need to do a make clean (respectively make -f your_makefile.mak clean) before you start compiling. The access to the graphic keyboard in gkb_win.c uses GDI (without +). This might work with a drw_gdip.c, but I am not sure. I plan to release my version of drw_gdip.c on GitHub as soon as I have time to make it compile. But you don't need to wait for that. If you already have an drw_gdip.c file that compiles you can send a pull request with your drw_gdip.c file to GitHub. In this case I will merge my drw_gdip.c stuff to your file. Best regards Thomas |
From: Thomas M. <tho...@gm...> - 2024-02-06 14:01:07
|
Hi Joe, Thank you for pointing out that sort was not documented. I have updated the documentation. Now, the link to "sort" at https://seed7.sourceforge.net/manual/types.htm#array points to https://seed7.sourceforge.net/libraries/array.htm#sort(in_arrayType) Tell me if this documentation is sufficient. Regards Thomas |
From: <med...@tu...> - 2024-02-02 11:19:53
|
Hi Thomas, I would like to sort a record (struct) by a field but am not sure how to use the sort function in this case. There is a link to "sort" at https://seed7.sourceforge.net/manual/types.htm#array at the end of the functions section but clicking on it just takes you to the home page. Thanks for creating seed7, it's a beautiful programming language. Cheers, Joe -- Sent with Tuta; enjoy secure & ad-free emails: https://tuta.com |
From: Zaakari <Za...@pr...> - 2023-10-24 21:53:09
|
Hey Thomas, I am interested in looking into writing a GDI+ graphics driver for Seed7; but I am not sure how I would get Seed7 to use it. If I make the file "drw_gdip.c", what do I have to change so that the Seed7 compiler/interpreter will use the new file under Windows instead of "drw_win.c"? Zachary |
From: Thomas M. <tho...@gm...> - 2023-09-02 08:36:57
|
Hi Zachary, In the past I already tried to support transparency and semi-transparency with an alpha channel. Because of the obstacles (see below) I did not succeed with this attempt. The GDI interface, that Seed7 uses to do graphics under Windows, does not support an alpha channel. The ability to set a transparent colour for a window is all that GDI supports. For this reason Seed7 supports only setting a transparent colour for a window. GDI+ supports an alpha channel but GDI+ is totally different from GDI. Using GDI+ would require writing a new graphics driver based on it. I just started writing a graphics driver based on GDI+ again (but this will take time). I have already removed some obscacles: - GDI+ uses a C++ interface and Seed7 is written in pure C. This can be solved by using the gdiplus/gdiplusflat.h include file (it provides a C interface). - Including gdiplusflat.h triggers tons of errors about missing types and defines. In the internet I found reports from people struggled with this. Most of them gave up. I found out that this succession of include statements work with MinGW: #include "windows.h" #include "gdiplus/gdiplus.h" #include "gdiplus/gdiplustypes.h" #include "gdiplus/gdiplusflat.h" Hopefully this works also for other C compilers under Windows. Now it is necessary to write all the functions needed by the graphics driver. After writing a GDI+ graphics driver (drw_gdip.c) it is necessary to also support an alpha color component in the X11 driver (drw_x11.c) and in the JavaScript/Browser driver (drw_emc.c). I have also an unfinished OpenGL driver that would also need support for an alpha color component. I have not investigated how this could be done in the other drivers. Seed7 can only support an alpha channel if it works on all supported platforms. I am working on the issue but I cannot promise anything. Any help with this work is highly welcome. :-) Thomas |
From: Zaakari <Za...@pr...> - 2023-08-25 22:28:52
|
Hey Thomas, Would you be willing to add support for an alpha component to the color object, so that transparent and semi-transparent pixels and shapes could be drawn? Also, could an alpha-enabled function be added to do the same when drawing pixmaps (so images as a whole could be rendered with various transparencies)? I see there is the ability to set a transparent colour for primitive windows, but that comes at the cost of a colour, and doesn't cover partial transparency (or single-object transparency). Zachary |
From: Thomas M. <tho...@gm...> - 2023-06-26 14:34:09
|
Hi Renato, Sorry for the delay. I have added your suggestions regarding the build of Seed7 on a Mac. See: https://seed7.sourceforge.net/build.htm#COMPILING_UNDER_MAC_OS You wrote: > I would also like to suggest adding a GitHub action that can do the above automatically, and push the binaries on the GitHub Releases Assets, > so people can download it from there (Linux, Mac and Windows are supported). Let me know if you need help to set that up and I can send a PR! I have not done GitHub actions until now. Are these just files in the repository? It would be great if you would create GitHub actions for Linux, Mac and Windows and send a PR. Many thanks in advance for your effort. Regards Thomas Mertes |
From: Renato A. <re...@at...> - 2023-06-14 15:53:38
|
Hi Tomas, I am really curious about Seed7 so I decided to build it on my Mac M1. I had only a small issue with the x11 lib not being found, which I solved by installing it using brew: brew install libx11 And then linking it from the brew location to /usr/local/include, so the C compiler can find it: sudo ln -s /opt/homebrew/include/X11 /usr/local/include/X11 After this I was able to build the compiler without issues... make -f mk_osxcl.mak depend make -f mk_osxcl.mak make -f mk_osxcl.mak s7c I am writing because I think you may want to include the above in your documentation to make it a bit easier for people... I would also like to suggest adding a GitHub action that can do the above automatically, and push the binaries on the GitHub Releases Assets, so people can download it from there (Linux, Mac and Windows are supported). Let me know if you need help to set that up and I can send a PR! Cheers, Renato Athaydes |
From: Thomas M. <tho...@gm...> - 2023-03-08 13:12:15
|
Hi Gary, I found something about "operation not permitted" in a MacOS terminal: https://osxdaily.com/2018/10/09/fix-operation-not-permitted-terminal-error-macos Starting with MacOS Mojave 10.14 they restricted what a terminal can do. Maybe this is the reason for "operation not permitted" and why sudo does not help. You can use the fix and try installing Seed7 again. If you don't want to use the fix I have another solution: I released Seed7 version 2023-03-05. In this release I changed mk_osx.mak and mk_osxcl.mak to use -mv ../doc/s7.1.gz /usr/share/man/man1 instead of mv ../doc/s7.1.gz /usr/share/man/man1 The - makes a difference. According to the description of the make commend (at https://thomasmertes.github.io/Seed7Home/scrshots/make7.htm ): If a command is prefixed with a minus sign (-) possible errors of the command are ignored. This should also apply to the make command of MacOS. So the installation of Seed7 should finish without stopping with "operation not permitted". The difference is: The manual pages of s7 and s7c will not be installed. But there are other ways to invoke the manual pages of Seed7. On my (Linux) computer I can do: seed7_5/src> man ../doc/s7.1 to display the manual page of s7. Probably this works also on MacOS (maybe it is necessary to specify an absolute path to s7.1). Please tell me, if you had success. Regards Thomas |
From: Thomas M. <tho...@gm...> - 2023-03-01 18:35:48
|
Hi Gary, The FAQ explains editor support for syntax highlighting: https://seed7.sourceforge.net/faq.htm#syntax_highlighting Regards Thomas |
From: Duke N. <duk...@gm...> - 2023-03-01 18:19:59
|
From: Thomas M. <tho...@gm...> - 2023-03-01 17:59:14
|
Hi Gary, When I do: > sudo gzip -c ../doc/s7.1 > /usr/share/man/man1/s7.1.gz I also get the error message: bash: /usr/share/man/man1/s7.1.gz: Permission denied But > sudo make install works on my computer. But maybe the combination of sudo and redirection from a makefile does not work on your computer. I changed mk_osx.mak and mk_osxcl.mak to use gzip -c ../doc/s7.1 > ../doc/s7.1.gz mv ../doc/s7.1.gz /usr/share/man/man1 instead of gzip -c ../doc/s7.1 > /usr/share/man/man1/s7.1.gz See attachments. Please try this and tell me about the result. Regards Thomas |
From: Gary C. <ch...@ma...> - 2023-02-26 16:06:59
|
Hi Thomas, Thank you for sharing your post on Reddit Pascal. I’m running Mac OS 13.2.1 and I’ve downloaded the latest copy of Seed7 (seed7_05_20230130.tgz <https://sourceforge.net/projects/seed7/files/seed7/seed7_05_20230130/seed7_05_20230130.tgz/download>). I’ve successfully compiled the Seed7 interpreter and now I’m in the process of compiling the Seed7 compiler. I was successfully with the following steps: 1) make s7c 2) make test 3) make utils But I was unsuccessful with the step 4) sudo make install ➜ src sudo make install mkdir -p /usr/local/bin cd ../bin; ln -fs `pwd`/s7 /usr/local/bin cd ../bin; ln -fs `pwd`/s7c /usr/local/bin gzip -c ../doc/s7.1 > /usr/share/man/man1/s7.1.gz /bin/sh: /usr/share/man/man1/s7.1.gz: Operation not permitted make: *** [makefile:171: install] Error 1 Since it was a permission error, I logged in as root - but still no joy. Thank you, Gary |
From: Zaakari <Za...@pr...> - 2022-07-30 19:08:09
|
Hey Thomas, First, some background. I've been working on a graphics editor for some time now (in Seed7, of course), and one of its main features is that the user can not only edit which hotkeys perform the various actions, but that he can edit the actions themselves (to a certain extent). This feature lead to defining a syntax for some "config" files which the editor parses--translating them into conditions and actions within the code. But as more features have become necessary/desirable, this syntax has grown rather complex to the point where I'm starting to feel like I'm making another language. As happy as I am to be making a customizable editor, it also feels like I am--perhaps pointlessly--"redefining the wheel". It feels like a waste to parse a whole bunch of new syntax, when I'm all ready using the wonderful language and parser that is Seed7. Not to mention that the complex strings read from the config files cannot be completely parsed into variables as that would require the use of pointers (and would likely be a confusing mess), and therefore the program's speed suffers due to having to parse part of the content each time a "hotkey" is matched. All that to say, it had me wondering if I could use Seed7 itself instead of making custom syntax within config files. Obviously, this could be done if I never compiled the resulting program, and just left it as a script to be run by the interpreter. But that would be less-than-ideal and needlessly confusing for the end-user as there would only be a few files they should be editing (not the whole program). Also that would require that all such programs be open-source (which might not always be desirable). Therefore, do you think it would be possible to make dynamic libraries for Seed7 programs, in the Seed7 language (similar idea to ".so" files or "DLLs")? This way I could have the end-user could write their own "library" for the hotkey management (a library that would be required by the graphics editor), which would then benefit from the type-safety and speed of being actual Seed7 code, as well as remove the need for designing another "config language". If this is possible, I'm guessing you'd also want to add some security features to the dynamic loading process, like having a separate command for including dynamic libraries (so that static libraries can't be overridden); and the ability to restrict which other libraries/functions are available to each dynamic library (so that they can't just do whatever they want)--perhaps something like a function/includes "whitelist". Anyway, I was thinking something like this could be very useful (might help with making "moddable" games too), but what do you think? Zachary |
From: Zaakari <Za...@pr...> - 2022-07-23 20:49:34
|
Hey Thomas, It seems I have encountered a bug involving interfaces. I've attached a short script to demonstrate the problem, but--in short--if you pass an object as an "in var" parameter into a function accepting an interface type, then pass that parameter into a sub-function as an "inout" parameter, any changes made to the object in the sub-function will affect the original object at the top level (even though, it was initially passed in as "in var"). This problem doesn't seem to occur with either simple types (like integers) or with non-interface objects, just with implementation types. If you would take a look some time, that would be great. Thanks, Zachary |
From: Duke N. <duk...@gm...> - 2022-06-19 18:09:08
|
Thanks!! — Duke Sent from my iPhone > On Jun 19, 2022, at 12:00 PM, Thomas Mertes <tho...@gm...> wrote: > > On Tue, 14 Jun 2022 15:29:00 +0200 Duke Normandin <dukeof...@gm...> wrote: >> So I was translating the seed7 for loop as: >> >> for [number=1 to the length of the array] do >> <some_code> >> end for; >> >> I assume that number is incremented internally. Something like the >> `foreach' construct in some languages. > > Yes, this loop works as foreach loop (and the index (number) is hidden). > > BTW I have improved the explanation in the tutorial to explicitely > state that it is a for-each-loop. See: > > http://seed7.sourceforge.net/manual/tutorial.htm#For_loop_and_containers > > I also added more examples of for-each-loops (with hash maps etc.). > > Regards > Thomas > > > > _______________________________________________ > Seed7-users mailing list > See...@li... > https://lists.sourceforge.net/lists/listinfo/seed7-users |
From: Duke N. <duk...@gm...> - 2022-06-19 18:06:54
|
Sorry about the garbled msg. It’s all good. The file needed tweaking. 😀 — Duke Sent from my iPhone > On Jun 19, 2022, at 11:44 AM, Thomas Mertes <tho...@gm...> wrote: > > On Sun 12. Jun 2022 15:36:00 +0200 Duke Normadin <dukeof...@gm...> wrote: >>> ---------- begin seed7.nanorc ---------- >> >> # Seed7 syntax highlighting for Nano editor >> # on Debian distros, this file lives in $HOME/.config/nano/ >> # change the colours to suit your taste. >> >> syntax "seed7" "\.sd7" >> ... >>> ---------- end seed7.nanorc ---------- >> >> This nano syntax file is a WIP and my first attempt to get >> something working. It needs improvement that is certain. :) > > The email program garbled the seed7.nanorc file a litte bit, > but I was able to restore it. > > I also did some improvements. The new version of seed7.nanorc > can be found here: > > https://github.com/ThomasMertes/seed7/blob/master/doc/seed7.nanorc > > What do you think about these improvements? > > Regards > Thomas > > > > _______________________________________________ > Seed7-users mailing list > See...@li... > https://lists.sourceforge.net/lists/listinfo/seed7-users |
From: Thomas M. <tho...@gm...> - 2022-06-19 18:00:42
|
On Tue, 14 Jun 2022 15:29:00 +0200 Duke Normandin <dukeof...@gm...> wrote: > So I was translating the seed7 for loop as: > > for [number=1 to the length of the array] do > <some_code> > end for; > > I assume that number is incremented internally. Something like the > `foreach' construct in some languages. Yes, this loop works as foreach loop (and the index (number) is hidden). BTW I have improved the explanation in the tutorial to explicitely state that it is a for-each-loop. See: http://seed7.sourceforge.net/manual/tutorial.htm#For_loop_and_containers I also added more examples of for-each-loops (with hash maps etc.). Regards Thomas |
From: Thomas M. <tho...@gm...> - 2022-06-19 17:50:14
|
On Sun, 12 Jun 2022 15:41:00 +0200 Duke Normadin <dukeof...@gm...> wrote > I know enough Emacs Lisp to hack my .emacs file, but that is all. > I believe what is needed is a seed7-mode.el. What /current/ > language would you say seed7 most resembles? I would suggest Ada or Modula2 as both languages have statements that are similar to the ones of Seed7. Regards Thomas |
From: Thomas M. <tho...@gm...> - 2022-06-19 17:44:23
|
On Sun 12. Jun 2022 15:36:00 +0200 Duke Normadin <dukeof...@gm...> wrote: > > ---------- begin seed7.nanorc ---------- > > # Seed7 syntax highlighting for Nano editor > # on Debian distros, this file lives in $HOME/.config/nano/ > # change the colours to suit your taste. > > syntax "seed7" "\.sd7" > ... > > ---------- end seed7.nanorc ---------- > > This nano syntax file is a WIP and my first attempt to get > something working. It needs improvement that is certain. :) The email program garbled the seed7.nanorc file a litte bit, but I was able to restore it. I also did some improvements. The new version of seed7.nanorc can be found here: https://github.com/ThomasMertes/seed7/blob/master/doc/seed7.nanorc What do you think about these improvements? Regards Thomas |
From: Duke N. <duk...@gm...> - 2022-06-14 13:29:24
|
On Tue, 14 Jun 2022 07:55:48 +0200 Thomas Mertes <tho...@gm...> wrote: > On Mon, 13 Jun 2022 21:08:00 +0200 > Duke Normandin <dukeof...@gm...> wrote: > > In your manual, you have the following examples: > > > > for number range [] (0, 1, 2, 3, 5, 8, 13, 20, 40, 100) do > > for innerPlanet range {"Mercury", "Venus", "Earth", "Mars"} do > > for letter range "the quick brown fox jumps over the lazy dog" > > do > > > > Is it correct to think of `range' to mean: "to the length of"? > > for number "to the length of" [] (0, 1, 2, .... 20, 40,100) do > > I don't know what you mean with "to the length of". > There is no 'range' function. Instead the keyword 'range' is > part of the for-loop. In case of It's not clear what the meaning of `range' is. Usually in other languages it can mean something like [i .. i_nth] a generator. So I was translating the seed7 for loop as: for [number=1 to the length of the array] do <some_code> end for; I assume that number is incremented internally. Something like the `foreach' construct in some languages. -- Duke ** Bottom-posting, text-only is the netiquette way! ** |
From: Thomas M. <tho...@gm...> - 2022-06-14 05:56:02
|
On Mon, 13 Jun 2022 21:08:00 +0200 Duke Normandin <dukeof...@gm...> wrote: > In your manual, you have the following examples: > > for number range [] (0, 1, 2, 3, 5, 8, 13, 20, 40, 100) do > for innerPlanet range {"Mercury", "Venus", "Earth", "Mars"} do > for letter range "the quick brown fox jumps over the lazy dog" do > > Is it correct to think of `range' to mean: "to the length of"? > for number "to the length of" [] (0, 1, 2, .... 20, 40,100) do I don't know what you mean with "to the length of". There is no 'range' function. Instead the keyword 'range' is part of the for-loop. In case of for number range [] (0, 1, 2, 3, 5, 8, 13, 20, 40, 100) do write(number <& " "); end for; writeln; The program actually writes the line: 0 1 2 3 5 8 13 20 40 100 So number gets all the values from the array one by one. Internally this for-loop has some index into the array (to the array element that is currently assigned to number). But this for loop does not show you the index. If you have more questions just ask. Regards Thomas |