G
Giuseppe
Guest
Hello,
what is the difference between -> and ~> operator??
Giuseppe
what is the difference between -> and ~> operator??
Giuseppe
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
list(obj1->myprop obj2->myprop obj3->myprop obj4->myprop)lstOfObjs=list(obj1 obj2 obj3 obj4)
lstOfObjs~>myprop
is like doing:
list(obj1~>myprop obj2~>myprop obj3~>myprop obj4~>myprop)
foreach(mapcar obj lstOfObjs obj->myprop)or put another way:
foreach(mapcar obj lstOfObjs obj~>myprop)
So with squiggle, each entry in the list needs to be able to have a ->So with squiggle, each entry in the list needs to be able to have a ~
operator on it for this to work.
Regards,Hope that clears it up!
Regards,
Andrew.
I didn't even suggested he was wrong. obviously he was
I meant right of course
Hello,
what is the difference between -> and ~> operator??
Giuseppe
no! atoms are everyting other than lists with the exception ofAtoms
-----
An atom is any data object that is not an aggregate of other data
objects. In other words, atom
is a generic term covering data objects of all scalar data types. [...]
---
this couldn't be clearer. when you see this, you understand 100% how ~
works. I think in the doc it isn't that clear however. apparently
definition of atom or "atomic object" should be "anything but a list".
cheers,
stéphane
Actually that's what I tend to do (when writing using C-like syntax, which Itraditionally however, ~> was used to access dbobjects and -> was
used to represent SKILL's built in data types. I normally
use ~> with dbobjects such as
d_inst~>name to emphasis that d_inst is a dbobject. However,
not so many people agree with my usage.
Just to make this thread complete for future reference as novice SKILLActually that's what I tend to do (when writing using C-like syntax, which I
don't do often...) - so I _would_ agree with your usage!
(getq obj prop) or (putpropq obj value prop)Andrew Beckett wrote:
Actually that's what I tend to do (when writing using C-like syntax, which I
don't do often...) - so I _would_ agree with your usage!
Just to make this thread complete for future reference as novice SKILL
programmer:
How would you write the -> and ~> operators when you don't use the
C-like syntax?
It's all to do with how they work with lists. For most objects they areHello,
what is the difference between -> and ~> operator??
Giuseppe
Andrew, ~> is used in a no of places in your reply where, I think, -
should have been used. Did you reply when you were sleepy
lstOfObjs=list(obj1 obj2 obj3 obj4)
lstOfObjs~>myprop
is like doing:
list(obj1~>myprop obj2~>myprop obj3~>myprop obj4~>myprop)
list(obj1->myprop obj2->myprop obj3->myprop obj4->myprop)
or put another way:
foreach(mapcar obj lstOfObjs obj~>myprop)
foreach(mapcar obj lstOfObjs obj->myprop)
So with squiggle, each entry in the list needs to be able to have a ~
operator on it for this to work.
So with squiggle, each entry in the list needs to be able to have a -
operator on it for this to work.
Hope that clears it up!
Regards,
Andrew.
Regards,
Suresh
There's a difference between the mathematical concept of a scalarWell this is not 100% clear... to my opinion, disembodied property
lists, defstructs, association tables, and user types do not seem to be
scalar, hence they are not atoms. because to my knowledge scalar is
usually used to designate stuff that can be represented by a
single number.
I didn't even suggested he was wrong. obviously he was (and as you sayRegardless of what the documentation states, what it infers, or how it
reads between the lines, Andrew is correct here.[*]
this couldn't be clearer. when you see this, you understand 100% how ~>To verify, I just
checked the SKILL source, and the code for ~> is (in pseudocode):
x~>y:
if x is a list:
mapcar z~>y for every element z in x
otherwise:
return x->y
Suresh,
No, what I said was correct. In fact what you suggested as replacements
were incorrect.
For example, if it worked as you suggested, then doing:
listOfDpls~>myprop
would get the value of myprop from each dpl within the list of dpls, since
-> is a valid operator in a DPL. But that's not what happens.
If you use ~> on a list, then each object in the list must in itself accept
~>.
Regards,
Andrew.
On Fri, 11 Feb 2005 13:58:18 +0530, Suresh Jeevanandam
sureshj@DELETETHISti.com> wrote:
Andrew, ~> is used in a no of places in your reply where, I think, -
should have been used. Did you reply when you were sleepy
lstOfObjs=list(obj1 obj2 obj3 obj4)
lstOfObjs~>myprop
is like doing:
list(obj1~>myprop obj2~>myprop obj3~>myprop obj4~>myprop)
list(obj1->myprop obj2->myprop obj3->myprop obj4->myprop)
or put another way:
foreach(mapcar obj lstOfObjs obj~>myprop)
foreach(mapcar obj lstOfObjs obj->myprop)
So with squiggle, each entry in the list needs to be able to have a ~
operator on it for this to work.
So with squiggle, each entry in the list needs to be able to have a -
operator on it for this to work.
Hope that clears it up!
Regards,
Andrew.
Regards,
Suresh