by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:35
    qtxie closed #4590
  • 08:35
    qtxie labeled #4590
  • 08:35
    qtxie labeled #4590
  • 08:35
    qtxie labeled #4590
  • 08:34
    qtxie assigned #4590
  • 08:31

    qtxie on master

    FIX: issue #4590 (RANDOM -21474… (compare)

  • 04:43
    theSherwood commented #4583
  • 03:24
    theSherwood commented #4583
  • 02:41
    qtxie closed #4622
  • 02:41
    qtxie labeled #4622
  • 02:41
    qtxie milestoned #4622
  • 02:40

    qtxie on master

    FIX: issue #4622 (error compili… (compare)

  • 02:39
    qtxie labeled #4622
  • 02:39
    qtxie labeled #4622
  • 02:38
    qtxie assigned #4622
  • Aug 13 19:41
    9214 edited #4148
  • Aug 13 19:37
    9214 edited #4608
  • Aug 13 18:33
    hiiamboris labeled #4625
  • Aug 13 18:31
    hiiamboris labeled #4604
  • Aug 13 18:31
    hiiamboris labeled #4604
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.
You will be a great test case though. :^)
Maciej Łoziński
@loziniak

@greggirwin @giesse this proposed paren notation for me is natural consequence of having similar mechanism in defining path!s, which is very convenient for me:

>> a: [b [c 123]]
== [b [c 123]]
>> get to path! reduce ['a (to-word "b") 'c]
== 123
>> a/(to-word "b")/c
== 123

So, for me 1x(pow 3 2) is more easy to read/understand and shorter than as-coord 1 pow 3 2. At first glance you see that this expression is a coord!.

Gregg Irwin
@greggirwin

@loziniak I'm used to parens in paths from many years of Reboling, though I don't use them often. However, they are still considered an experimental feature in Red, as we are not sure they are worth keeping.

To make sure I understand your example, you have code with 2 known values and variable key between them, like accessing a keyed record's field. Here's a more efficient way to do that, which seems clearer to me:

>> a: [b [c 123]]
== [b [c 123]]
>> k: to word! "b"
== b
>> a/:k/c
== 123

Does the path approach give you some other benefit that I don't see at a glance?

Gregg Irwin
@greggirwin
Pairs today are completely literal in their syntactic form. There is no evaluation whatsoever, which has pros and cons, and is simply a design choice. Because of the separator used (x), which is not "special" like /, it opens up a lot more questions and potential ambiguity. Paths are specifically meant for indirect access, and have to start with a word. Do pairs in your design have to start with a literal number, or is (pow 3 2)x(pow 2 3) valid as well? Because that's no longer Red compatible as a syntactic form. If that's not valid in your design, you can only evaluate the y axis, which seems much less useful and general.
Vladimir Vasilyev
@9214
Besides
>> x: make op! :as-pair
== make op! [["Combine X and Y values into a pair" 
    x [integer! f...
>> (power 3 2)x(2 ** 3)
== 9x8
Maciej Łoziński
@loziniak
@greggirwin in your example, k is not a very meaningful name for a variable. I find it clearer to use expression to word! "b" in-place. I did not think about using get-words though, because parens were first thing I tried and it worked, so I searched no more.
hiiamboris
@hiiamboris
@9214 clever! :+1:
Maciej Łoziński
@loziniak
@9214 try to do that with hypothetic coord! :-)
@greggirwin good point about syntax incompatibility of having x part of pair! defined by paren!. That kindda invalidates my idea.
Vladimir Vasilyev
@9214
@loziniak and how can I try to do that if it's hypothetical? Thought experiment?
Maciej Łoziński
@loziniak
Exactly. Just assume it's real. Brillant hack nevertheless.
Gregg Irwin
@greggirwin

:point_up: September 27, 2019 11:16 AM @9214, you're going to Hell for that. ;^) Lacking the power to send you there, I will have to concede that it's an AWFULly cool idea for a dialect.

@loziniak forgive me for not trying to come up with a more meaningful name in a short chat example. ;^)

get-field-c-from-var-a-for-rec: func [
    key [string!]
][
    key: to word! key
    a/:key/c
]
a: [b [c 123]]
get-field-c-from-var-a-for-rec "b"
Shoot, should have called it rec-id.
9214 @9214 aww jeez man.
Maciej Łoziński
@loziniak
@greggirwin Point taken, my names also don't carry much meaning. But everytime I can, I try to avoid variables like key, index etc.
GiuseppeChillemi
@GiuseppeChillemi

@greggirwin

I'm used to parens in paths from many years of Reboling, though I don't use them often. However, they are still considered an experimental feature in Red, as we are not sure they are worth keeping.

I use it a lot !

Dave Andersen
@dander
@greggirwin, here's a concrete example of using path construction (granted with all indexes in this case). It would probably be better to use word! instead of index in the cases where that is applicable, but then it would need to know if that word! was being reused in that branch of the tree...
Gabriele Santilli
@giesse
@loziniak sure, but, path! is already a block-like type, while pair! is not.
Gregg Irwin
@greggirwin
@dander path construction isn't an issue. That's an alternative, because you're making the path from other parts, not putting parens in a literal path for their evaluative property.
@GiuseppeChellemi examples?
Vladimir Vasilyev
@9214

For the reference, the main argument against paren! in paths is a stylistic one: you can abuse them with multi-line expressions or ungodly mess like inclusion of external files and deeply nested code logic.

head/(
...
<you can embed whole Red runtime here for all I care>
...
)/(
...
)/tail

One path (no pun intended) we can take is to prohibit newlines during path! lexing, thus allowing only simple, single-line expressions. Another is to get rid of them entirely.

Maciej Łoziński
@loziniak
And one more – leave it as it is now, letting a programmer choose her own style.
luce80
@luce80
@greggirwin example:
page: 1 per_page: 10

for page 1 41 1 [
    out: probe join out-head [per_page * page - per_page + 1 "-" per_page * page  ".json.txt" ]
    file: read to-rebol-file out
    probe length? file
    file: head remove/part file 3 ; remove initilal (UTF?) garbage
    json: json-to-block file
    ;probe copy/part mold json 100
    for n 2 11 1 [
        attempt[insert/only tail items json/("html")/("body")/("div")/4/("div")/("div")/("div")/2/("div")/1/("div")/("div")/1/("div")/:n/("div")/1/("div")/("span")]
    ]
    page: page + 1
    if (probe length? file) < 90 [break]; 75
]
probe count: length? items
{
probe items/2/1/("a")/1/("#text") ; creator
probe items/2/1/("a")/2/("@href") ; link
probe items/2/1/("a")/2/("strong")/("#text") ; filename
probe items/2/2/("#text") ; description
}
Gregg Irwin
@greggirwin
@luce80 thanks. String keys are probably the strongest use case for the feature.
But here is another case where doing k: "div" once, and using :k in the path would be a big win. Or :div. :^)
Gregg Irwin
@greggirwin
json/("html")/("body")/("div")/4/("div")/("div")/("div")/2/("div")/1/("div")/("div")/1/("div")/:n/("div")/1/("div")/("span")
json/("html")/("body")/:div/4/:div/:div/:div/2/:div/1/:div/:div/1/:div/:n/:div/1/:div/("span")
json/("html")/("body")/:d/4/:d/:d/:d/2/:d/1/:d/:d/1/:d/:n/:d/1/:d/("span")
Vladimir Vasilyev
@9214
Allowing strings in paths without requiring extra parenthesis would make more sense. But then we end up with the exact same stylistic argument against multi-line {...}.
Gregg Irwin
@greggirwin
Yup.
Respectech
@Respectech
I also vote to leave parens in paths. Power to the people!
Petr Krenzelok
@pekr
Ditto, found them useful sometimes ....
GiuseppeChillemi
@GiuseppeChillemi

@greggirwin use parenthesis in path to select from an another block the position of the column I am searching for in the current one:

>> columns: [cd_ar 1 description 2 orders 5]
== [cd_ar 1 description 2 orders 5]
>> values: ["C00022" "Master Market" none none "22"]
== ["C00022" "Master Market" none none "22"]
>> values/(columns/description)
== "Master Market"
>>

When column name sequence index name reflect data position I use the following form to pick the data form the right position.

>> columns: [cd_ar  description  something something-else orders]
== [cd_ar description something something-else orders]
>> values: ["C00022" "Master Market" none none "22"]
== ["C00022" "Master Market" none none "22"]
>> values/(index? find columns 'description)
== "Master Market"
>>
GiuseppeChillemi
@GiuseppeChillemi

Sometime I define an helper function to return me the right index

>>  columns: [cd_ar  description  something something-else orders]
== [cd_ar description something something-else orders]
>> values: ["C00022" "Master Market" none none "22"]
== ["C00022" "Master Market" none none "22"]
>> ps: function [column columns-pos] [index? find columns-pos column]
== func [column columns-pos][index? find columns-pos column]
>> values/(ps 'description columns)
== "Master Market"
>>

It is really useful when I navigate database data. Also I am planning more complex index retrieving experimenting with custom datatypes and their data position but I am currently in early stage as the data description language is currently building up in my mind.

GiuseppeChillemi
@GiuseppeChillemi
Also I am working on a way to access data in multiple separate blocks where each part of the path could jump to another pre-existant or computed block. This work is based on path access notation experiment created from ToomasV. All of those ways to dinamically access data blocks need parenthesis to be expressed in "serialized" form (hope the term "serialized" is used correctly here).
Beeno Tung
@beenotung
I tried to compile a hello world program w/wo -r flag,
why is the binary smaller in dev mode?
shouldn't release version be trimmed more aggressively?
Semseddin Moldibi
@endo64
@beenotung in release mode (-r) your compiled program and Red runtime are packed into one file, that's why it is bigger. In dev mode runtime is not included in your executable, that means you need to ship your program with the runtime (libRedRT.dll on Windows) otherwise it won't work.
Gregg Irwin
@greggirwin
Thanks for the examples @GiuseppeChillemi. Much appreciated.
GiuseppeChillemi
@GiuseppeChillemi
@greggirwin Your are welcome. Parenthesis impact a lot on my day to day programming style.
Palaing
@Palaing

I want to split a string (a 2-column table from a database query) with both "^-" and "^/" characters to get a flat block of items.
When the string is too long (13060 characters), the following:

split rawdata charset "^-^/"

fails with a "not enough memory" message. While this:

split replace/all rawdata  "^/" "^-" "^-"

works fine and fast.
I was just wondering why the first one would not...

hiiamboris
@hiiamboris
@Palaing what's the build you're using? I cannot reproduce the issue on Red 0.6.4 for Windows built 25-Sep-2019/22:36:30+03:00 commit #f753e25
GiuseppeChillemi
@GiuseppeChillemi
@greggirwin and I think I have just found a possible solution to access data with reusable paths. But I will need a little help from the RED team that should implement a feature to express this solution in a coincise manner.
Palaing
@Palaing
@hiiamboris I'm on Red 0.6.4 date: 3-Apr-2019/11:40:57+02:00 commit: #492254683df98fd779b4157466f54a625007d80e
(I don't change so often as I'm used to gui-console-not-starting problems)