Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 10:29

    qtxie on atomic

    FEAT: adds a FIFO MPMC queue in… (compare)

  • Aug 23 22:24
    9214 updated the wiki
  • Aug 23 15:05

    dockimbel on atomic

    FEAT: adds support for system/a… (compare)

  • Aug 23 13:40

    dockimbel on atomic

    FEAT: improved the implementati… (compare)

  • Aug 23 12:52
    dockimbel commented #3991
  • Aug 23 12:27
    9214 commented #3991
  • Aug 23 12:13
    planetsizecpu commented #3991
  • Aug 23 12:12
    planetsizecpu commented #3991
  • Aug 23 11:18
    dockimbel commented #3991
  • Aug 23 10:14

    qtxie on atomic

    TEST: add some failed cases in … (compare)

  • Aug 23 10:06

    qtxie on atomic

    TESTS: add test for CAS operati… (compare)

  • Aug 23 09:22

    qtxie on atomic

    TESTS: add some tests for atomi… (compare)

  • Aug 22 21:26

    dockimbel on atomic

    FEAT: adds get-word support for… (compare)

  • Aug 22 21:00

    dockimbel on atomic

    FEAT: adds support for system/a… (compare)

  • Aug 22 17:48

    dockimbel on atomic

    FEAT: preliminary support for a… (compare)

  • Aug 22 15:51

    dockimbel on atomic

    FIX: removes some unused local … (compare)

  • Aug 22 15:20

    dockimbel on atomic

    FEAT: adds support for system/c… (compare)

  • Aug 22 10:35
    bitbegin assigned #4004
  • Aug 22 10:35
    bitbegin unassigned #4004
BeardPower
@BeardPower
@lepinekong_twitter Great. Another programmer interested in charts :smile:
mikeparr
@mikeparr
I've just updated the Red wikipedia page, mainly taking out 2 dead links. It already referred to the latest (July 2017) version. Thanks to @greggirwin for advice.
Gregg Irwin
@greggirwin

@lepinekong_twitter, it's gitter, not you. Thanks for your article! We can link to it from the Red wiki, though I'll make one suggestion first. Don't use form as a variable name. That's a standard, commonly used, function.

Thanks @mikeparr!

@akavel, I found that we have a note about the exact issue you encountered in the wiki: https://github.com/red/red/wiki/Reactivity
Greg T
@gltewalt
@greggirwin Seems to break help if you do use form: as a name.
>> form: [size 800x600 backdrop coal]
== [size 800x600 backdrop coal]
>> view form
>> help system
*** Script Error: pad does not allow word! for its n argument
*** Where: pad
*** Stack: help help-string pad  

>> help either
*** Script Error: uppercase does not allow block! for its string argument
*** Where: uppercase
*** Stack: help help-string
Greg T
@gltewalt
GUI Console
Boleslav Březovský
@rebolek
Not only form, if you redefine word used in other functions, you will break the functionality of them.
@gltewalt
>> a: 1
== 1
>> f: func [x][x + a]
== func [x][x + a]
>> f 3
== 4
>> a: 10
== 10
>> f 3
== 13
This is exactly same as redefining form
We will get protect, but right now you have to be careful.
Greg T
@gltewalt
I thought that view might bind its argument
Boleslav Březovský
@rebolek
bind to what
Greg T
@gltewalt
Oops I meant help. Bonding form so it remains intact in help. The original form
Boleslav Březovský
@rebolek
But that's not how Redbol works.
Word's value is determinated when the word is evaluated.
Boleslav Březovský
@rebolek
The original form of help (and other functions) is based on the belief that words mean what they mean. This is very important assumption in Redbol, because there are no keywords and words can have any value (without protect, that's not implemented in Red yet).
Gregg Irwin
@greggirwin
@gltewalt, then help would have to bind every word it depends on, as would every other function we write.
I commented and closed the associated ticket as well.
Greg T
@gltewalt
Ok
Gregg Irwin
@greggirwin
Nenad Rakocevic
@dockimbel
@greggirwin It would be useful to have support for both OS standard ones and View-based ones.
Gregg Irwin
@greggirwin
Yes, I wasn't sure what other OS standard dialogs were planned. I had these sitting around, half-done, for a long time, and am trying to clear out half-baked bits as much as anything. :^)
Also a great excuse to play more with how to build a general dialog model.
Nenad Rakocevic
@dockimbel
@lepinekong_twitter Great Red tutorial! I would be glad to tweet it and add the link to red-lang.org, though, redefining form word is really unfortunate. Let me know when you fix that, so I can publish the link everywhere. ;-)
Mateusz Czapliński
@akavel

Hi all! Is there a function in Red which would be used like this:

update obj ['foo 1 'bar/baz 2]

which would be equivalent to:

do [ obj/foo: 1 obj/bar/baz: 2 obj ]

? Where obj is an object!. If not, is it possible to define such function? (Macro would not work for me here.) I think this is maybe something like what they call "lenses" in Haskell etc, but I'm not sure, never used Haskell?

PeterWAWood
@PeterWAWood

@akavel I guess I don't really understand what you are looking for as most people would simply assemble a block and reduce it.

You could do this but at the expense of creating a new object:

>> o: make object! [a: 0 b: make object! [c: 0]] 
== make object! [
    a: 0
    b: make object! [
        c: 0
    ]
]
>> o: make o [a: 1 b/c: 2]
== make object! [
    a: 1
    b: make object! [
        c: 2
    ]
]
Mateusz Czapliński
@akavel
@PeterWAWood what do you mean by "reduce it"?
Boleslav Březovský
@rebolek
@akavel reduce evaluates block and returns block with results. I.e.:
>> reduce [1 + 2 3 + 4]
== [3 7]
PeterWAWood
@PeterWAWood
>> o: make object! [a: 0 b: make object! [c: 0]] 
== make object! [
    a: 0
    b: make object! [
        c: 0
    ]
]
>> new-a: 10
== 10
>> new-c: 20
== 20
>> reduce [o/a: new-a o/b/c: new-c]
== [10 20]
>> o
== make object! [
    a: 10
    b: make object! [
        c: 20
    ]...
>>
Mateusz Czapliński
@akavel
didn't know about reduce, thanks. So what I'd like is maybe like reduce, but that it would work in context of some object o, so that the o/ prefix could be removed from the block
is this possible?
Oldes Huhuman
@Oldes

@akavel you can use this:

with: func [obj body][do bind body obj]

and then:

>> o: make object! [a: 0 b: make object! [c: 0]] 
== make object! [
    a: 0
    b: make object! [
        c: 0
    ]
]
>> with o [a: 1 b/c: 2]
== 2
>> o
== make object! [
    a: 1
    b: make object! [
        c: 2
    ]
]
Mateusz Czapliński
@akavel
@Oldes woohooo! :D thanks! :) looks exactly like what I wanted! For extra trickiness, I'd maybe try to make it infix operator :)
and add a /copy refinement
Mateusz Czapliński
@akavel
Uhmh :/ if I create a func with a /copy refinement, can I still access the copy func from the "global scope" somehow? I understand it's shadowed by the copy name from the refinement... :/
Oldes Huhuman
@Oldes
if you redefine system word, you can access the original using system/words like system/words/copy in your case.
Mateusz Czapliński
@akavel
@Oldes woohoo, awesome, thanks again! :)
Ah, infix func can't have refinements. Ok, can make 2 separate funcs.
Mateusz Czapliński
@akavel
Eh :/ can I make something similar with a date!? bind doesn't seem to accept it as argument; maybe the trick with reduce would work here?...
Boleslav Březovský
@rebolek
With date? what are you trying to do exactly?
Mateusz Czapliński
@akavel
Suppose I'd have to deep-iterate the body, and prepend to all set-words an 'obj/' prefix?... then either reduce or just do?...
Mateusz Czapliński
@akavel
Hmmm, looking at implementation of replace func, that's probably the point where I should go and use some parse
Vladimir Vasilyev
@9214
@akavel you mean this?
>> collect [foreach . [time day year][keep/only make path! reduce ['now .]]]
== [now/time now/day now/year]
>> reduce [now/time now/day now/year]
== [19:54:08 9 2017]
Vladimir Vasilyev
@9214
you can't bind block or word to date!, simply because it's date!, not object!
:smiling_imp:
>> probe object collect [foreach accessor system/catalog/accessors/date! [keep to set-word! accessor] keep none]
make object! [
    date: none
    year: none
    month: none
    day: none
    zone: none
    time: none
    hour: none
    minute: none
    second: none
    weekday: none
    yearday: none
    timezone: none
    week: none
    isoweek: none
    julian: none
]
Mateusz Czapliński
@akavel
@9214 ok, based on your example, more like:
>> obj: make object! [date: now map: #(a: 1 b: 2)]
== make object! [
    date: 9-Nov-2017/16:35:18+01:00
    map: #(
        a: 1
        b: 2
    )
]
>> diff: [date/weekday: 1 map/a: 3]
== [date/weekday: 1 map/a: 3]
>> effect: collect [foreach . diff [keep/only case [set-path? . [make set-path! compose [obj (to-block .)]] true [.]]]]
== [obj/date/weekday: 1 obj/map/a: 3]
>> reduce effect
== [1 3]
>> obj
== make object! [
    date: 6-Nov-2017/16:35:18+01:00
    map: #(
        a: 3
        b: 2
    )
]
@9214 btw, how can I find about keep/only? typing ? collect in console only provides help about raw keep, no word about refinements...
Vladimir Vasilyev
@9214
@akavel you can check out source with ?? collect to find out
Mateusz Czapliński
@akavel
@9214 ok, thx; not ideal, but better than nothing
Vladimir Vasilyev
@9214
@akavel although your example could be simplified drastically
>> obj: object [date: now map: #(a: 1 b: 2)]
== make object! [
    date: 9-Nov-2017/21:01:50+05:00
    map: #(
        a: 1
        b: 2
    )
]
>> diff: [date/weekday: 1 map/a: 3]
== [date/weekday: 1 map/a: 3]
>> do bind diff obj
== 3
>> obj
== make object! [
    date: 6-Nov-2017/21:01:50+05:00
    map: #(
        a: 3
        b: 2
    )
]