Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 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

That's why I mentioned R/S.

And throwed confusion into the mix :wink:

BeardPower
@BeardPower
:smile:
I will look into the implementation.
Windows is currently driving me nuts
Vladimir Vasilyev
@9214
Conceptually they are the same, both represent namespaces. But Red's context and Red/System's context are different in their nature. Red's context is an internal datatype, which you can indirectly create during runtime and modify to some extent, Red/System's context is a compile-time construct which provides some form of static scoping.

I will look into the implementation.

Protip: red-context! is created in R/S as a part of Red's runtime, so it can't be a part Red/System's runtime :wink:

BeardPower
@BeardPower
R/S has no runtime.
Vladimir Vasilyev
@9214
@BeardPower duh?
BeardPower
@BeardPower
Sorry, damn mobile phone.
R/S does not need a run-time.
To stop with what?
Vladimir Vasilyev
@9214
@BeardPower your Sun-Time typo. :smile:
BeardPower
@BeardPower
Lol Yeah. I hate this Android shit...
Vladimir Vasilyev
@9214

R/S does not need a run-time.

Well, it needs some, otherwise it won't be of any practical use.

Let's move to /chit-chat or PM though.
nedzadarek
@nedzadarek
@9214 @BeardPower I disagree with some things but I get why you say "we cannot manipulate contexts". So, let's say I'll stick with your definition(s).
Vladimir Vasilyev
@9214
@nedzadarek saying that you can manipulate contexts is like saying that you can manipulate my heart rate by scaring me. You do not manipulate my heart beat, my organism does it in response to your action.
nedzadarek
@nedzadarek
@9214 I don't think your example is good. My action can scare you once, but next time you may just smile.
Vladimir Vasilyev
@9214
Whatever.
nedzadarek
@nedzadarek
Whatever.
GiuseppeChillemi
@GiuseppeChillemi
I have one veicle which has a GPS location device and a cloud service connected to it. The provider gave my a REST API key to communicate with its service. Could I use RED for this purpose ? Is there a tool or sample code and which scripts are needed ?
Vladimir Vasilyev
@9214
@GiuseppeChillemi you need to make HTTP requests with write/info and utilize API of this service.
Boleslav Březovský
@rebolek
Vladimir Vasilyev
@9214
Also see here.
GiuseppeChillemi
@GiuseppeChillemi
Could a function refinement have multiple and different words for each /refinement ?
Vladimir Vasilyev
@9214
@GiuseppeChillemi not sure what you mean by that. You can specify as many arguments as you need.
nedzadarek
@nedzadarek
@GiuseppeChillemi if you mean aliasing (e.g. foo/a is the same as foo/b) then no. You can however set words when you call one refinement, something like this:
f: function [/a a-var1 /b b-var1] [
  if a [b: a b-var1: a-var1] 
  if b [a: b a-var1: b-var1]  

  reduce [a a-var1 b b-var1] 
]

f
; == [false none false none]
f/a 1
; == [true 1 true 1]
f/b 1
; == [true 1 true 1]
Vladimir Vasilyev
@9214

if you mean aliasing (e.g. foo/a is the same as foo/b) then no

Ultimately this depends on how you implement a function.

GiuseppeChillemi
@GiuseppeChillemi

I mean:

f: function [/a a-var1 /b b-var1 b-var2]

Where b-var-2 is the second argument of /B

Vladimir Vasilyev
@9214
@GiuseppeChillemi have you actually tried to implement such function with multiple refinement arguments?
GiuseppeChillemi
@GiuseppeChillemi
Never
Just asking as I have not RED here
Vladimir Vasilyev
@9214
foo: func [x /a argument /b another one and many others][
    print [
        argument
        another one and many others
    ]
]
>> foo/a/b 'first 'second 'third 'fourth 'et 'cetera '.
second third fourth et cetera .
As you can see, sometimes you can answer your question yourself. :wink:
GiuseppeChillemi
@GiuseppeChillemi
Are you sure they belongs to /b ? They could be unrelated and general arguments like X because the example could work even if RED works the other way ;-)
@9214
Vladimir Vasilyev
@9214
@GiuseppeChillemi if you call a function with refinement, then you must to supply all of its arguments. And function spec requires all arguments to have unique names.

if you call a function with refinement, then you must to supply all of its arguments.

There exists an exception for this, though, it should remain unknown, to encourage best coding practices.

nedzadarek
@nedzadarek

@9214

Ultimately this depends on how you implement a function.

Do you mean a function creators that makes values of type function! (e.g. does, has, function etc)?

There exists an exception for this, though, it should remain unknown, to encourage best coding practices.

Just post it with a warning like DO NOT USE IT or something like this.

@GiuseppeChillemi I overdid with my answer. Sorry.

Vladimir Vasilyev
@9214
>> foo: func [/a x /b y][if any [a b][sort reduce [x y]]]
== func [/a x /b y][if any [a b] [sort reduce [x y]]]
>> foo/a 'arg
== [none arg]
>> foo/b 'arg
== [none arg]
>> foo
== none
GiuseppeChillemi
@GiuseppeChillemi
Tomorrow I'll try without /b and giving one less argument when calling the function.
Vladimir Vasilyev
@9214
Contrary to your comment, foo/a and foo/b are "the same".
GiuseppeChillemi
@GiuseppeChillemi
@rebolek I Need to extract columns and aliases from SQL queries. Do you know if such code has already been implemented ? I have found something in sql-protocol.r but has no aliases management.
nedzadarek
@nedzadarek

Contrary to your comment, foo/a and foo/b are "the same".

Could you elaborate?

Vladimir Vasilyev
@9214

@nedzadarek on what? foo called with two different refinements returns identical results. Thereas you said:

if you mean aliasing (e.g. foo/a is the same as foo/b) then no.

Of course you could start arguing that since foo/a and foo/b are two different path! values they are not the same, but, as far as encapsulation and functions go, they are the same.
nedzadarek
@nedzadarek
@9214 Ah, I mean setting it in the function's spec, like this: f: func [/ref1 = /ref2 a b] [ print a print b], so whenever you call f/ref1 1 2 or f/ref2 1 2 the results are "the same".
Vladimir Vasilyev
@9214
Actually, even your original example contradicts your comment.
@nedzadarek and that could be done with function constructor other than func or function.