Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 2019 22:59
    @dockimbel banned @SmackMacDougal
  • Dec 03 2017 05:53
    @PeterWAWood banned @matrixbot
  • Sep 28 2016 12:19
    @PeterWAWood banned @TimeSeriesLord
  • Aug 13 2016 03:23
    @PeterWAWood banned @Vexercizer
Vladimir Vasilyev
@9214
and they are already covered here, so I don't see a need in another collection of links
nedzadarek
@nedzadarek
@9214 but are there some difference between Red's and Rebol 2 & Rebol 3 's parse?
ps. that I cannot think because I sing the song!
Vladimir Vasilyev
@9214
@nedzadarek Red's parse is more sophisticated than R2 version, but on a par with R3, I guess.
nedzadarek
@nedzadarek
Then I would like to keep such informations... if possible.
Vladimir Vasilyev
@9214
@nedzadarek you don't need to ask for permission to start a wiki page, if that's what you mean.
nedzadarek
@nedzadarek
That's good to know! Thank you.
Gregg Irwin
@greggirwin

@lepinekong_twitter, at this stage in your Red career, if someone offers a hint, clue, or suggestion in answer to a question or problem you pose, please take some time to understand their response, rather than immediately saying "Why would I need to...?"

Do you understand the behavior now? If not, does this help?

type: word!
blk: [
    unset! [
        print "unset!"
    ] 
    word! string! file! url! block! [
        print "word! string! file! url! block!"
    ]
]
switch type blk

find blk type

type? type
find blk type? type

type? first blk
find blk 'word!

switch type reduce blk

There should be no more explanation needed than this, and is an example of how to go about learning and debugging on your own.

Before pasting the entire thing into a console, see if you can predict what each result will be, then add the next statement. If the result isn't what you expected, think about it and see if the result makes sense.
PeterWAWood
@PeterWAWood
Please could somebody who has compiled, installed and run the Android example take a look at this ML message and see if they can help the young poster.
Vladimir Vasilyev
@9214
@PeterWAWood he needs latest Red sources from Android branch for that, which is private ATM.
Vladimir Vasilyev
@9214
That is - no one but @dockimbel compiled it (and he shared an APK here for inter-community testing purposes), others should wait for 0.7.1 milestone with full Android support.
PeterWAWood
@PeterWAWood
@9214 Thanks. I've let the youngster know.
lepinekong
@lepinekong_twitter
@greggirwin sorry but red is supposed to be simple but as for type testing it's a headache compared to other languages.
Vladimir Vasilyev
@9214
@lepinekong_twitter maybe it's because you haven't learned the fundamentals?
which you supposed to do if you want to be proficient in the language.
Vladimir Vasilyev
@9214
I bet "other languages" don't have 47 (and counting) built-in datatypes ;)
BeardPower
@BeardPower
We should aim for at least 200 ;-)
nedzadarek
@nedzadarek
@lepinekong_twitter @9214 Red has some quirks like (type? first [integer!]) = (type? integer!) but the language is more or less fair/concise when you learn some "weird stuffs" (like only word/refinement used in append or parse's change).
ps. most language have quirks
Vladimir Vasilyev
@9214
Everything is a quirk if you don't understand the difference between types of values.
Nenad Rakocevic
@dockimbel

@nedzadarek

>> type? first [integer!]
== word!
>> type? integer!
== datatype!

In the first case, the word inside the block is not evaluated (because nothing causes it to be evaluated), in the second case, the word is the argument of a function, so it gets evaluated (it evaluates to a datatype!) . No quirks here, just basic evaluation rules of the language. Once we get syntax coloring in the console, it should be easier to spot the difference between values of different types having same literal form.

Vladimir Vasilyev
@9214
>> equal? type? first [integer!] type? 'integer!
== true
>> equal? type? first [#[integer!]] type? integer!
== true
nedzadarek
@nedzadarek
@9214 @dockimbel I mean quirks in non-tech way. You see something that looks like, for example, datatype! but it is word!
Vladimir Vasilyev
@9214
@nedzadarek integer! is a word bound to datatype value.
nedzadarek
@nedzadarek
@9214 yes... but pi: 3.14 is the same, "word bound to float value". For simplicity "a float".
Vladimir Vasilyev
@9214
Except that word is not a float, it's a separate entity which can refer to other values, including floats.
Yours and @lepinekong_twitter's confusion boils down to
>> foo: 'bar
== bar
>> 'foo = foo
== false
nedzadarek
@nedzadarek

Except that word is not a float, it's a separate entity which can refer to other values, including floats.

You are right. However Red users prefers to use X! as to say "it's a word containing datatype". We can use pi!: 42 but it breaks conventions.

'foo looks different than foo. I may be biased but foo looks like variable in most language (or some variable-like thing in language that doesn't like mutations). 'foo looks like some kind of symbol or something. So I would assume that you are comparing some value 'foo with variable foo.

Vladimir Vasilyev
@9214
You're comparing two evaluation results - leftmost is lit-word! that evaluates to word!, and rightmost word! which evaluates to bound value. Somehow you expect the two to be equal (it can be if foo is bound to word! foo).
>> foo: 'foo
== foo
>> 'foo = foo
== true
Your "I guess" and "it looks like" with "I would assume" makes me think that we're on some kind of quiz game. Every programming language have evaluation rules, and Red too. Once you learn them, there's no place for "guessing" and "assuming".

Because, following your "oh it looks like X so it should be X" logic, this:

(((,[:+/_2&{.)@](^:(2-~[)))&1 1)

is a, well, regex, I guess.

while in fact it's a Fibonacci sequence function.
nedzadarek
@nedzadarek

Once you learn them, there's no place for "guessing" and "assuming".

Yes but some features of a language are more obvious than others.

Because, following your "oh it looks like X so it should be X" logic, this:

(((,[:+/_2&{.)@](^:(2-~[)))&1 1)

is a, well, regex, I guess.
while in fact it's a Fibonacci sequence function.

Forth or some similar language?

Vladimir Vasilyev
@9214
No, it doesn't even look like Forth. It's J. They both encourage tacit programming though. :)
nedzadarek
@nedzadarek
@9214 yeah, tacit programming and people mention forth here so I assumed that's Forth:D
btw. are you J programmer?
Vladimir Vasilyev
@9214
I've yet to see a language where some feature is obvious from the start.
nedzadarek
@nedzadarek
@9214 but when you programmed in a few languages then some features are "obvious", like most languages have some kind of simple container, Ruby/C/... have arrays [1, 2, 3], Lisp has lists (1 2 3), Lua has tables {1 2 3}.
JacobGood1
@JacobGood1
red has... blocks?
Vladimir Vasilyev
@9214
I tend to not borrow baggage from other languages when I learn a new one. Your Lisp list is an s-expression though, and an incorrect one (1 is not a function).
JacobGood1
@JacobGood1
unless it was passed to a macro or if it was preprocessed =)
nedzadarek
@nedzadarek
^^ yes, it should be with something like this, afair '(1 2 3)
Vladimir Vasilyev
@9214
That's what I'm saying - you either learn the rules as they are or live with your assumptions (that (1 2 3) is a list and foo is a variable) until they hit you in the back.
nedzadarek
@nedzadarek
@JacobGood1 yes, red has blocks and they are similar to Lisp's/Lua's in that they can contain values with different types.
@9214 Yes, we should learn the rules (I don't deny it) but we take some "informations" from other languages that we have learned. In my opinion, a good way to learn is by mistakes. When you get some error when you try compare integer! with first [integer!] then you have "eureka moment" - ah, it's different, I should test/ask about it. I learn faster that way.
Vladimir Vasilyev
@9214
@nedzadarek learning by mistakes is one thing, but claiming that "oh it's bad it's not like in other languages I'm confused it's hard not hot" like some people do, is another.
nedzadarek
@nedzadarek
@9214 I'm not saying it's super bad/hard. It's just not super obvious like other language features: parse [1] [integer!]