zbyti Posted December 13, 2021 Share Posted December 13, 2021 In #344 was incorrect Rebol forum link to FizzBuzz - fixed. It may have looked intentional but it was not. Quote Link to comment Share on other sites More sharing options...
Kaj de Vos Posted December 13, 2021 Author Share Posted December 13, 2021 That forum has a permalink on top of the threads. The normal links change when new posts appear on the forum. 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 Not everything works as expected in the Rebol world 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 (edited) Which example is more readable and "human-friendly"? Meta [ Title: {FizzBuzz math "game"} Author: "Kaj de Vos" Rights: "Copyright (c) 2021 Kaj de Vos" License: { PD/CC0 http://creativecommons.org/publicdomain/zero/1.0/ } Notes: { https://wiki.c2.com/?FizzBuzzTest https://www.rosettacode.org/wiki/FizzBuzz } ] For counter 100 [ Third?: unless modulo counter 3 [write "Fizz"] Any [ unless modulo counter 5 [write "Buzz"] third? write counter ] Write " " ] Write new-line or For number 100 [ p: 0 unless modulo number 3 [p: 1 write "Fizz"] unless modulo number 5 [p: 1 write "Buzz"] if p = 0 [write number] Write " " ] Write new-line 1, 2 or none? maybe this one? For number 100 [ p: 0 unless modulo number 3 [p: 1 write "Fizz"] unless modulo number 5 [p: 1 write "Buzz"] unless p [write number] Write " " ] Write new-line Edited December 14, 2021 by zbyti Quote Link to comment Share on other sites More sharing options...
ilmenit Posted December 14, 2021 Share Posted December 14, 2021 It's probably just a personal preference but I'd say "none" Lets compare with the Python solution: for number in range(1, 100): if number % 3 == 0 and number % 5 == 0: print('FizzBuzz') elif number % 3 == 0: print('Fizz') elif number % 5 == 0: print('Buzz') else: print(number) 1 Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 Quote Link to comment Share on other sites More sharing options...
ilmenit Posted December 14, 2021 Share Posted December 14, 2021 ? Quote Link to comment Share on other sites More sharing options...
Kaj de Vos Posted December 14, 2021 Author Share Posted December 14, 2021 I think Zbyti's version follows the Principle of Least Surprise. I optimise my programs heavily with REBOL constructs that are elegant and that I know to generate efficient code, but not all of them are available in other languages. I want the examples to show off Meta's strengths, but in beginners' guides I will start with simpler constructs. Many REBOL examples are different because they disregard efficiency. I think they make too much use of the dynamic features of the language. I inherited that attitude from Atari. Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 1 minute ago, ilmenit said: ? Quote Link to comment Share on other sites More sharing options...
Kaj de Vos Posted December 14, 2021 Author Share Posted December 14, 2021 11 hours ago, zbyti said: Not everything works as expected in the Rebol world Yep, you get free thinkers with original solutions. Quote Link to comment Share on other sites More sharing options...
ilmenit Posted December 14, 2021 Share Posted December 14, 2021 38 minutes ago, Kaj de Vos said: Many REBOL examples are different because they disregard efficiency. I think they make too much use of the dynamic features of the language. I inherited that attitude from Atari. Many programmers like to feel smart by writing very dense code and like in their eyes "elegant solutions". In many software houses such approach is considered a "bad habit" leading to "write-only code". Such code is hard to read for the ones who didn't write it, require compilation of the code in the head, is hard to modify and makes life harder for new programmers. While languages nowadays are very powerful and flexible it also takes experience not to use all the fancy features the language provides. Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 (edited) I think my last example shows a problem in trying to talk to the computer with too many words: [unless modulo number "works" do something] in other words: do something if something happens. unless p I'm reading - do something if something didn't happen. Edited December 14, 2021 by zbyti Quote Link to comment Share on other sites More sharing options...
TGB1718 Posted December 14, 2021 Share Posted December 14, 2021 I think what we are missing is comments !!! yes, that age old thing that many programmers just don't do. As this is a new language, adding a comment alongside each line of code will help explain not just what the program is doing, but also give insights on how the language works 1 Quote Link to comment Share on other sites More sharing options...
Kaj de Vos Posted December 14, 2021 Author Share Posted December 14, 2021 In the end, these problems are caused because our brains are limited. A language that can express more concepts in the same space is said to be more expressive. Thus, bigger challenges fit in your head when the programs are smaller. It seems to be a problem of communication between human and machine, but the machine actually concurs. It, too, is limited, and smaller programs perform better. Quote Link to comment Share on other sites More sharing options...
Kaj de Vos Posted December 14, 2021 Author Share Posted December 14, 2021 2 minutes ago, TGB1718 said: I think what we are missing is comments !!! yes, that age old thing that many programmers just don't do. As this is a new language, adding a comment alongside each line of code will help explain not just what the program is doing, but also give insights on how the language works This example is ten lines and is compared with equivalent versions in hundreds of other languages. That should be enough for such an example. As I said, in beginners' guides I will build it up as simple as possible, keeping the feedback here in mind. Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 I think that symbolic languages are more exact and does not get the brain involved in understanding words but only problems. Quote Link to comment Share on other sites More sharing options...
Kaj de Vos Posted December 14, 2021 Author Share Posted December 14, 2021 22 minutes ago, ilmenit said: Many programmers like to feel smart by writing very dense code and like in their eyes "elegant solutions". In many software houses such approach is considered a "bad habit" leading to "write-only code". Such code is hard to read for the ones who didn't write it, require compilation of the code in the head, is hard to modify and makes life harder for new programmers. While languages nowadays are very powerful and flexible it also takes experience not to use all the fancy features the language provides. Meta is not APL: https://www.rosettacode.org/wiki/FizzBuzz#APL or K: https://www.rosettacode.org/wiki/FizzBuzz#K Meta is deliberately designed to be more verbose, literally. That's why I claim it to be closer to natural language. It is designed to work at a similar verbosity as human language. Quote Link to comment Share on other sites More sharing options...
Kaj de Vos Posted December 14, 2021 Author Share Posted December 14, 2021 4 minutes ago, zbyti said: I think that symbolic languages are more exact and does not get the brain involved in understanding words but only problems. Meta is just as exact. It's Lisp with types added. But it tries to use real English words instead of weird abbreviations, and only the math symbols that many people are familiar with. Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 (edited) @Kaj de Vos you do your job developing META I do mine using it. I have my preferences like K65 over 6502 mnemonics but I'm always open to something new. You demand feedback - I provide one Edited December 14, 2021 by zbyti Quote Link to comment Share on other sites More sharing options...
Kaj de Vos Posted December 14, 2021 Author Share Posted December 14, 2021 Because Meta is word based, you will be able to equate existing methods to any weird Unicode symbol you want. Pi would be useful, for example. 1 Quote Link to comment Share on other sites More sharing options...
ilmenit Posted December 14, 2021 Share Posted December 14, 2021 1 minute ago, zbyti said: I think that symbolic languages are more exact and does not get the brain involved in understanding words but only problems. If I'm correct, adults usually do not read single letters in words but read familiar words as a symbols, leading to these tasks like "count the Fs" or https://www.lookhuman.com/design/58406-if-you-can-read-this-you-are-smart/tshirt (while in case of children just learning it's an issue). Quote Link to comment Share on other sites More sharing options...
Kaj de Vos Posted December 14, 2021 Author Share Posted December 14, 2021 https://www.lookhuman.com/design/58406-if-you-can-read-this-you-are-smart/tshirt I think John Lennon and Einstein would be able to read that. Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 28 minutes ago, Kaj de Vos said: In the end, these problems are caused because our brains are limited. A language that can express more concepts in the same space is said to be more expressive. Thus, bigger challenges fit in your head when the programs are smaller. It seems to be a problem of communication between human and machine, but the machine actually concurs. It, too, is limited, and smaller programs perform better. I read the biography of Stanisław Ulam and there was a discussion about what language is better and mor suitable for certain things. The gentlemen knew 3 languages then, maybe four (Latin?). If I'm not mistaken they found German more suitable for mathematics than Polish, I don't remember what they said about the French language Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 9 minutes ago, ilmenit said: If I'm correct, adults usually do not read single letters in words but read familiar words as a symbols, leading to these tasks like "count the Fs" or https://www.lookhuman.com/design/58406-if-you-can-read-this-you-are-smart/tshirt (while in case of children just learning it's an issue). yes, I think this only happens if the words are relatively small in number and are used frequently - such as key words in programming languages. Quote Link to comment Share on other sites More sharing options...
zbyti Posted December 14, 2021 Share Posted December 14, 2021 7 minutes ago, Kaj de Vos said: https://www.lookhuman.com/design/58406-if-you-can-read-this-you-are-smart/tshirt I think John Lennon and Einstein would be able to read that. I can read that, I often have a bigger problem with what I write myself Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.