|
-
Jun 8th, 2000, 05:28 PM
#1
Thread Starter
transcendental analytic
Look at this:
0 Imp 0 = 1
0 Imp 1 = 1
1 Imp 0 = 0
1 Imp 1 = 1
What possibly could you need the imp operator for? I have never used it, never seen it used, never heared of it, don't know what it is good for, and everything else tells me Imp is the most useless operator in vb. Is it?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 8th, 2000, 05:38 PM
#2
Fanatic Member
Imp ????
--------------------------------------------------------
Ahhh MSDN Definition
Code:
Dim A, B, C, D, MyCheck
A = 10: B = 8: C = 6: D = Null ' Initialize variables.
MyCheck = A > B Imp B > C ' Returns True.
MyCheck = A > B Imp C > B ' Returns False.
MyCheck = B > A Imp C > B ' Returns True.
MyCheck = B > A Imp C > D ' Returns True.
MyCheck = C > D Imp B > A ' Returns Null.
MyCheck = B Imp A ' Returns -1 (bitwise comparison).
[Edited by r0ach on 06-09-2000 at 12:41 PM]
r0ach™
Don't forget to rate the post
-
Jun 8th, 2000, 05:48 PM
#3
PowerPoster
Hey! kedaman, I thought you're out of the Gotham City?
-
Jun 8th, 2000, 05:52 PM
#4
Thread Starter
transcendental analytic
Hehe, i'll stay another week, i got phone call
r0ach, what! i know that but can you find any practical use of it or is it just a practiacal joke?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 8th, 2000, 06:00 PM
#5
Fanatic Member
uhm, let's see...
No. I can't think of anything.
Sorry.
I tried to see if it might be the opposite of another operator (like Eqv operator being opposite of Xor), but it's not.
r0ach™
Don't forget to rate the post
-
Jun 9th, 2000, 06:40 AM
#6
Maybe they stuck it in there for fun, or just to have more functions.
There are a lot of functions in VB that people have never heard about.
-
Jun 9th, 2000, 07:35 PM
#7
Thread Starter
transcendental analytic
Surely it must be useful for something, or why would they have that example, i don't know why?!?!!?
and the inverse function to imp must be not imp
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 9th, 2000, 09:15 PM
#8
Hyperactive Member
Imp And Or Xor
Hi,
Well Imp is definitly related to And Or and Xor. Following is what MSDN has to say about each. Maybe someone can make sense of this.
Sorry for the formatting. ( Or the lack thereof )
Al.
Imp Operator
Used to perform a logical implication on two expressions
Syntax
result = expression1 Imp expression2
The Imp operator syntax has these parts:
Part Description
result Required; any numeric variable
expression1 Required; any expression.
expression2 Required; any expression.
Remarks
The following table illustrates how result is determined:
If expression1 is And expression2 is The result is
True True True
True False False
True Null Null
False True True
False False True
False Null True
Null True True
Null False Null
Null Null Null
The Imp operator performs a bitwise comparison of identically positioned bits in two numeric expressions
and sets the corresponding bit in result according to the following table:
If bit in expression1 is And bit in expression2 is The result is
0 0 1
0 1 1
1 0 0
1 1 1
And Operator
Used to perform a logical conjunction on two expressions
Syntax
result = expression1 And expression2
The And operator syntax has these parts:
Part Description
result Required; any numeric variable
expression1 Required; any expression.
expression2 Required; any expression.
Remarks
If both expressions evaluate to True, result is True. If either expression evaluates to False, result is False.
The following table illustrates how result is determined:
If expression1 is And expression2 is The result is
True True True
True False False
True Null Null
False True False
False False False
False Null False
Null True Null
Null False False
Null Null Null
The And operator also performs a bitwise comparisonof identically positioned bits in two numeric expressions
and sets the corresponding bit in result according to the following table:
If bit in expression1 is And bit in expression2 is The result is
0 0 0
0 1 0
1 0 0
1 1 1
Or Operator
Used to perform a logical disjunction on two expressions
Syntax
result = expression1 Or expression2
The Or operator syntax has these parts:
Part Description
result Required; any numeric variable
expression1 Required; any expression.
expression2 Required; any expression.
Remarks
If either or both expressions evaluate to True, result is True. The following table illustrates how result is determined:
If expression1 is And expression2 is Then result is
True True True
True False True
True Null True
False True True
False False False
False Null Null
Null True True
Null False Null
Null Null Null
The Or operator also performs a bitwise comparisonof identically positioned bits in two numeric expressions
and sets the corresponding bit in result according to the following table:
If bit in expression1 is And bit in expression2 is Then result is
0 0 0
0 1 1
1 0 1
1 1 1
Xor Operator
Used to perform a logical exclusion on two expressions
Syntax
[result =] expression1 Xor expression2
The Xor operator syntax has these parts:
Part Description
result Optional; any numeric variable
expression1 Required; any expression.
expression2 Required; any expression.
Remarks
If one, and only one, of the expressions evaluates to True, result is True. However, if either expression is Null
result is also Null. When neither expression is Null, result is determined according to the following table:
If expression1 is And expression2 is Then result is
True True False
True False True
False True True
False False False
The Xor operator performs as both a logical and bitwise operator. A bit-wise comparison
of two expressions using exclusive-or logic to form the result, as shown in the following table:
If bit in expression1 is And bit in expression2 is Then result is
0 0 0
0 1 1
1 0 1
1 1 0
A computer is a tool, not a toy.
-
Jun 10th, 2000, 12:14 AM
#9
Thread Starter
transcendental analytic
So what's the big deal with imp? What possibly could you have use for with imp, Al?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 10th, 2000, 02:44 AM
#10
Hyperactive Member
I give up.
Hi,
I've got a headache trying to figure out the logic.
The logical operator Imp seems to be illogical.
Al.
A computer is a tool, not a toy.
-
Jun 10th, 2000, 03:36 AM
#11
PowerPoster
illogical?
We can use it for AI then
-
Jun 10th, 2000, 03:49 AM
#12
Junior Member
it looks familar. The imp operator is use to see if 2 variables are the same. the operators And, Or, and Xor are used to restrict the statement. If u only use the imp operator then what it does is check to see if the statements are the same or different. Using the other operators changes the value u recieve. Example: Either both values must be true or one of the 2 values must be true. with the Or and Xor operators it works this way. I am not sure what way it actually is, but anyway here it goes.
with one operator the first variable stated must be true and the second one false. with the other operator it is the exact reverse. the first one must be false and the second one must be true.
Now the logical purpose for these operators is in some financial program or one where the difference between given variables is extremely important.
I remember most of this from a critical thinking class i took couple semesters back. the true/false table with the information reminded me of all this
-
Jun 10th, 2000, 04:23 AM
#13
Frenzied Member
it's the same as the => operator in maths, it's pronounced "implies", a => b means that if a is true then b is true, which gives us the results you are getting. I suspect it's used for completeness, if you add it to the And Or and Xor operators then take 2 boolean values.
a and b
there are 4 possible sets of results
1 a is true b is true
2 a is false b is true
3 a is true b is false
4 a is false b is false
now if we divide these up into 2 catagoried eg
1&2, 3&4 or 3,1&2&4 there are 16 ways of doing this.
for any way of dividing them up we can have a simple statement
Code:
If a X b Then
Call Firstfunc
Else
Call SecondFunc
End If
where X is one of the four bitwise operators sutch that if the state of the variables is one catacory it calls firstfunc if it's in the other catagory calls secondfunc
(you may have to switch the functions around or just have a or True or something insted of a X b)
as for uses it has uses but if you're not used to using it it could be easier just to use Not (a And (Not b)) or ((Not a) Or b) instead. but Imp would be slightly faster.
-
Jun 10th, 2000, 04:59 AM
#14
Frenzied Member
It's residue from the old days , when bit manipulation was more common.
-
Jun 10th, 2000, 06:01 AM
#15
Thread Starter
transcendental analytic
=> argh! <= How can you more dumb than that, it's in the name, implies. Thanks Sam, but i think it's still a bit useless since i have never thought of having use of => in vb
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 11th, 2000, 04:20 AM
#16
Has anyone heard of the PPmt function? I was looking for diffeent functions today and came across this one. It calculates interest on money.
-
Jun 11th, 2000, 05:46 AM
#17
Thread Starter
transcendental analytic
well i'm not interested in money, ok of course i am, but not interested in interests, there are a bunch of those functions: DDB,Ipmt,IRR,MIRR,NPer,NPV,Pmt,PPmt,PV,Rate,SLN,SYD, so i don't know, I have never used those.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 11th, 2000, 05:48 AM
#18
-
Feb 1st, 2001, 10:29 AM
#19
Frenzied Member
GOT IT!!
I've found a used for imp!!!!
I frequently have to set files to writable in Windows Explorer (you know, right-click properties etc. ) so I thought that if I wrote a small app which reads the file name from the command line I could put a short-cut to it in "send to"
it would speed thing up a bit.
I don't want to do SetAttr Filename,vbNormal because I want to leave all other attribute in place eg, hidden etc.
So, to set a file as writable I need to clear BIT 1 if set and leave it clear if not set.
so here it is:
Code:
Option Explicit
Sub Main()
Dim Files() As String
Dim i As Integer
Files = Split(Command(), " ")
For i = 0 To UBound(Files())
SetAttr Files(i), Not (GetAttr(Files(i)) Imp vbReadOnly)
Next i
End Sub
-
Feb 1st, 2001, 10:52 AM
#20
Would't that be the same as:
SetAttr Files(i), GetAttr(Files(i)) OR vbReadOnly
-
Feb 1st, 2001, 10:56 AM
#21
Frenzied Member
try it Frans C
-
Feb 1st, 2001, 11:23 AM
#22
Thread Starter
transcendental analytic
old posts showing up again looking at how stupid you've been back then 
The definitions of implication i found in my papers:
p imp q = (p or q = q)
p imp q = not(p) or q
p imp q = p and q = p
btw mark,
not(a imp b)
is the same as
a and not(b)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 1st, 2001, 11:34 AM
#23
Oops, I missed a bracket.
I misread:
SetAttr Files(i), Not (GetAttr(Files(i)) Imp vbReadOnly)
for:
SetAttr Files(i), Not (GetAttr(Files(i))) Imp vbReadOnly
-
Feb 2nd, 2001, 03:06 AM
#24
Frenzied Member
kedaman
you're right of course
a AND(NOT b) is somewhat clearer...
The search for a use for IMP continues......
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|