Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 19:47
    9214 commented #4701
  • 19:43
    hiiamboris commented #4701
  • 19:41
    hiiamboris edited #4702
  • 19:41
    hiiamboris edited #4702
  • 19:37
    hiiamboris opened #4702
  • 19:15
    9214 commented #4701
  • 19:09
    hiiamboris commented #4701
  • 04:50
    Travis red/red#4701 broken (5385)
  • 04:29
    qtxie commented #4701
  • 04:29
    qtxie commented #4701
  • 04:25
    qtxie commented #4701
  • 04:21
    qtxie commented #4701
  • 04:20
    qtxie opened #4701
  • 04:18
    qtxie assigned #4700
  • 03:47
    qtxie commented #4700
  • Oct 30 20:30
    hiiamboris opened #4700
  • Oct 30 20:14
    hiiamboris commented #86
  • Oct 30 20:02
    greggirwin commented #86
  • Oct 30 19:00
    hiiamboris opened #86
  • Oct 30 18:18
    hiiamboris edited #4699
linoonphan
@Linoonphan
In an article updated in June this year, the article said that it will release the Red/Android beta release in September this year. may i ask when there will be new news about Red/Android
Qingtian
@qtxie
After more reading, I think totally switch to float32-pair should be fine. Every integer between -16777217 and 16777217 has an exact floating-point representation. For the use case of the integer-pair, this is quite enough. That means we can process an image size up to 16777217x16777217 pixels without problem. We can use pair in a textarea which has up to 16777217 columns and 16777217 rows.
Toomas Vooglaid
@toomasv

Some half-baked musings:

  1. I think conformance to mathematical notation is not too important. There are plethora of expressions and constructs in programming languages for which there are specific mathematical notations that are too cumbersome to support lexically in a PL. Think e.g. of powers and roots. Type-ability, readability and Redfitness (conformity to Red-ways) are more important.

  2. When it is easy to support it is advantageous of cause to have lexical form which is already established in mathematics (in some variation). In case of (1.0, 2.34, 3.01234) it is easy to type and read, but 1.0x2.34x3.01234 is not too bad also, albeit a bit harder to read. But the parens/comma version brings confusion with paren evaluation mentioned above. E.g. compose [a (b) (1.0, 2.34, 3.14)]. It's probably mainly psychological confusion as lexer can presumably easily recognize it as a special type. But visually, it's in parens but not a paren!.

  3. Can other forms be considered, e.g. x(1.0 2.34 30.1234)? But it seems even harder to read, unless longer spaces are used: x(1.0 2.34 30.1234).

  4. If with three members, it is certainly not a pair! anymore. To be semantically precise it is more of a point than coordinate. According to MW (geometric) point is "a geometric element that has zero dimensions and a location determinable by an ordered set of coordinates". Coordinates are values characterising the location of a point in different dimensions. Nitpicking, coordinates determine the location or position of a point. So may-be loc! or pos!? But then again, it depends on interpretation, these values can also characterize not position of a point but dimensions of an object. E.g. (3, 10, 5) may be dimensions of an ellipsod, not a point or position. Thus, to leave room for different interpretations, it should rather be triple! analogously to pair!. But (sorry!) then it can't have just two members (as it was proposed to have two or three members). (It is probably pointless to point out that out of geometry "point" is not particularily pointed term. Did I make my point?)

  5. What usage might this point!/loc!/coord!(let it be point! for now) have besides "coordinates of the position of a point"? Complex numbers and quaternions (and tessarines and bicomplex numbers) pop into mind. Two-member point!might be interpreted as a complex number, quaternion might be presented as a block of float! and 3-member point!.

  6. If pair! can include float! members as @qtxie points out above, then it seems very Redfit to have "floating" triplet!s like 1.1x2.2x3.0 or 1x2x3 too.

Qingtian
@qtxie
@Linoonphan Nope. Plan changes as usual. :sweat_smile: We should have only say what we were working on at that time in the blog article.
Gregg Irwin
@greggirwin

Good thoughts. Thanks for weighing in @toomasv. Even for the puns. :^)

3) seems like a bad path to head down.

5) leads to more thoughts, like aliasing. But this is also a slippery slope. With Red you really have to know the context to give something meaning, but the ability to alias types could enforce more strictness. I tend to lean toward pushing that enforcement up into dialects and modules, but there are arguments to be made both ways.

I like the idea of triple!, as it is domain non-specific, but it also has a very different connotation in the RDF domain. We already have that problem with tuple in other langs and such, so it's not a big problem IMO.

Qingtian
@qtxie
(Continuing) Switch to float32-pair, the user should not need to update anything. While some runtime function need to be changed to support float arguement. For example, pick and poke for image!, we need to do the conversion internally in those actions. The conversion should be safe if the range is between [-16777217, 16777217].
Gregg Irwin
@greggirwin
We had quite a conversation in the Ren space long ago, about the name tuplex!.
Issue! is another type that spans many uses, and while the name is imperfect for many of them, nobody has come up with a better one.
Aliases sound nice, but offer a false sense of type safety, which is worse than offering none at all.
So you really want to say that the implementation is shared, but by giving it a new name, it is a new type.
Gregg Irwin
@greggirwin
But that's not perfect either. It's just all tradeoffs and, as you say, finding the best fit in Red, overall, is the goal.
Qingtian
@qtxie

So you really want to say that the implementation is shared, but by giving it a new name, it is a new type.

@greggirwin You mean the float32-pair? No new datatype, My proposal is what this PR does. (red/red#4049)

Gregg Irwin
@greggirwin
Sorry @qtxie, I meant the general discussion of pair/point/triple/quad/coord/loc/pos.
hiiamboris
@hiiamboris
What do we do in case of 0.0x1.0 / 0.0x0.0 ?
Paren form allows us to define such values as (1.#inf, 0). x-form does not: 1.#infx0.0
R3 didn't solve that:
>> 1e10x0 * 1e40
== I.nfinitye9998x-N.aNe9998

>> I.nfinitye9998x-N.aNe999
** Script error: I.nfinitye9998x-N.aNe999 has no value
Toomas Vooglaid
@toomasv
@greggirwin Er.. was it question to me? ("So you ...")
Gregg Irwin
@greggirwin
Rhetorical. It's late for me, so take everything in that light. :^)
Qingtian
@qtxie
@hiiamboris We support this 1.#NaNx1.#INF in the lexer, though it's ugly.
Toomas Vooglaid
@toomasv
@greggirwin If I understand the question to imply that I proposed introducing new types by just renaming , then noooo. What I meant was example of possible usage of float32-pair as complex number, like currently I might use [a i] in this way. Operations on it should be still implemented separately.
Gregg Irwin
@greggirwin
I was springboarding thoughts off of yours. :^)
linoonphan
@Linoonphan
@qtxie If this is always the case, we are losing many developers.
Qingtian
@qtxie
@Linoonphan We're improving it.
@hiiamboris
>> 0.0x1.0 / 0.0x0.0
== 1.#NaNx1.#INF
>> type? 1.#NaNx1.#INF
== pair!
hiiamboris
@hiiamboris
Yeah I get that @qtxie. Thanks :) Real ugly, but useful.
hiiamboris
@hiiamboris
@toomasv I like the triplet!+pair! idea. Mainly because usually you expect a point of a certain dimensionality. View expects 2D pairs, while some theoretical 3D engine parts will expect 3D triplets. So it makes sense to enforce that dimensionality by the typing rather than bother with extra length checks. If there will appear a case where both 2D and 3D points should be accepted, one can always make a typeset: point!: make typeset! [pair! triplet!].
bitbegin
@bitbegin
for float32! pair!, we can use a new syntax like: #<1.0 2.0> to distinguish them ?
Qingtian
@qtxie

If there will appear a case where both 2D and 3D points should be accepted, one can always make a typeset: point!: make typeset! [pair! triplet!].

@hiiamboris Or just use the 3D triplet!. If it's used for 2D, the Z dimension can just be ignored.

hiiamboris
@hiiamboris

Moreover, most modern CPUs do floating-point arithmetic as fast as (or even faster than) integer arithmetic

After skimming thru https://www.agner.org/optimize/instruction_tables.pdf I have to agree. It's on par speedwise, and float multiplication can even be twice faster than that on integers.

Vladimir Vasilyev
@9214
So... initial proposal was to get float-based triple! / point! / whatnot, but now we have pair! that supports both integers and floats; then, what's the point (no pun intended) of triple!?
Vladimir Vasilyev
@9214
I mean, we can always squeeze an extra 4-byte value in the payload and get new datatype, but it doesn't seems like a priority to me, as we don't have any related use-cases. Not to mention the amount of design musings over lexical form that it requires.
Vladimir Vasilyev
@9214
How frequently whose coming from Rebol actually wrote float-based pair! as a literal value, instead of encountering it as an intermediate computation result? With images we reason in terms of x and y amount of pixels (discrete values, integers), and rarely think of subpixel position - rather, it's almost always a result of some precise geometric computation, hidden behind graphical facade.
Vladimir Vasilyev
@9214
i.e., 1.23x45.6 looks a bit quirky if you see it, but I can live with that, because I rarely will type it by hand.
Qingtian
@qtxie

i.e., 1.23x45.6 looks a bit quirky if you see it, but I can live with that, because I rarely will type it by hand.

I'm also OK with this format.

Qingtian
@qtxie
One problem of the float32-pair is in some old code we don't always use the pair/x and pair/y as number. We use it a flag sometimes. For example, In a text editor, we may use pair/x to store the line number, usepair/y as bitset flag to store some information. In this case, we cannot use float32. But it is kind of hacking code, I think we should just 2 integers. Or use vector! if we need to record every lines in the text editor.
Gregg Irwin
@greggirwin
:point_up: September 25, 2019 5:44 AM See what happens when you hack things @qtxie? ;^)
Qingtian
@qtxie
😅
Nenad Rakocevic
@dockimbel
FYI, the refactor-lexer branch was dropped. The most useful changes from that branch were ported to master. That branch has been replaced with the fast-lexer branch now, re-implementing the Red run-time lexer in R/S.
bitbegin
@bitbegin
@dockimbel the new lexer can parse all codes, and give all errors? Also, if it return the line/column, will be very useful.
Petr Krenzelok
@pekr
Question of an uneducated - Lexer parses Red source code, during the load, or even interpretation? By rewriting lexer in R/S, will it "just" load code faster or will generally interpreter be faster?
hiiamboris
@hiiamboris
Just load. Unless you are a fan of do load "my-code" patterns :)
Still, it's a very welcome change, as sometimes you load data. After 10MBs it's unbearably slow.
And as @bitbegin notes, preserving the info about the origins (line/column) of each word would be a tremendous help in debugging. Is this planned?
Nenad Rakocevic
@dockimbel
@hiiamboris @bitbegin It's a feature I want to add since a long time, but we still haven't figure out how to do the reverse mapping between a given value and its line/column info for debugging purpose. One way would be to extend the cell! size to fit such extra info. Though, we can return that info on syntax errors, that case is trivial.
hiiamboris
@hiiamboris
Perhaps one way is to change "index in symbol table" part of a word into a pointer to a structure with that data + the actual index?
Nenad Rakocevic
@dockimbel
@hiiamboris We need a reverse-mapping to line/column (and even filename) for any value, not just words.
Maciej Łoziński
@loziniak
My thoughts on floats in pair!
  1. Every 2D point could be considered also a 3D point, also conversion between float and int could be seamless:
    >> 1x1
    == 1.0x1.0x0.0
  2. My wish - could we make possible using parens like in path!?
    >> 1x(pow 3 2)
    == 1.0x9.0x0.0
  3. In special cases (discrete image pixels, editor line hacking) we can always use vector! of integer!s.
Gregg Irwin
@greggirwin
@loziniak 2) is a significant change, which opens the question for other segmented/multi-part values, like tuples. If you could mock up some more examples using that syntax, for use cases you imagine, we can more easily weigh things. It may be that we try an as-coord helper to start, and see if paren notation still has enough value.
Dave Andersen
@dander
image.png
More of a side-note, since not everyone would have them, but with a font that has ligatures, the x-delimited ones do look a bit nicer (this is Fira Code)
Gabriele Santilli
@giesse
@loziniak 1x(something) would have to be a new block-like type. So, even though those things look like great ideas, in practice they are not.
GaryMiller
@GaryMiller

Will Fast Lexer be in tomorrows available download?
Windows red-25sep19-f753e25c.exe 1.2 MB

Will be interested to try. My Lex is running about 9 seconds now when loading into Interpreter. ~62,000 lines of Red Code

Gregg Irwin
@greggirwin
No release date announced on fast lexer.