Shorthand if()?
1
Name:
Anonymous
2008-05-06 4:39
sup /prog/ ,
I was wondering whether any of you would use in lieu of
if(cond)
do_something();
the equivalent
cond && do_something();
or something like this for a function that returns 0 on error:
(s=get_foo()) || fprintf(stderr,"Error getting foo\n");
of course, multiline if-statements would be a bad idea with this, but how about if statements with a single body statement?
2
Name:
Anonymous
2008-05-06 4:40
no
3
Name:
Anonymous
2008-05-06 4:49
well i think gcc supports terniary ? thing with no else clause.
4
Name:
Anonymous
2008-05-06 5:09
It doesn't work if
do_something returns void, and it feels kinda silly to change to a different construct based on the return type of the then-clause.
>>3
What...
why ? Don't they like `if'?
5
Name:
Anonymous
2008-05-06 6:57
(when cond (do_something))
Fuck "if" if there's no "else" clause.
6
Name:
Anonymous
2008-05-06 7:35
>>3
foo ? expr : (void)0;
7
Name:
Anonymous
2008-05-06 7:47
>>1
I do it all the time. It's called Perl.
8
Name:
Anonymous
2008-05-06 7:52
for(;cond;){do_something(); break;}
9
Name:
Anonymous
2008-05-06 10:06
if me.hasanus()
hax(me)
else
hax(your.getanus())
10
Name:
Anonymous
2008-05-06 10:09
__ __ __ __ ____ ___ _________________________________________
|| || || || || || ||__ Hugs 98: Based on the Haskell 98 standard
||___|| ||__|| ||__|| __|| Copyright (c) 1994-2003
||---|| ___|| World Wide Web: http://haskell.org/hugs
|| || Report bugs to: hugs-bugs@haskell.org
|| || Version: November 2003 _________________________________________
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 6.6.1, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
11
Name:
Anonymous
2008-05-06 10:50
>>9
me your
Please learn English.
12
Name:
Anonymous
2008-05-06 11:53
Please upgrade,
>>10 .
% ghci
GHCi, version 6.8.2: http://www.haskell.org/ghc/ :? for help
Loading package base ... linking ... done.
'-._ ___.....___
`.__ ,-' ,-.`-,
`''-------' ( p ) `._
`-' ( Have you read your YAHT today?
\
. \
\---..,--'
................._ --...--,
`-.._ _.-'
`'-----'' Type :ihbt for help.
Prelude>
13
Name:
Anonymous
2008-05-06 12:05
>>12
I've been wanting to do it for over a week, but I have a fresh Ubanto install and I can't be bothered to download libs needed to make GHC 6.8.
14
Name:
Anonymous
2008-05-06 12:12
. . ,.".".'"""..
. ,__\.~~
. ;'``` '`` \!"
. `. \~"
.., ' ____________|'~"
`. .__/ |_| |\
`..' | = / | = ||
| \___/ |\___|/
| _| |
\ __ |
\ /__\ ./
|`'._____.'|
/| /\
/ update your \
fucking GHC,
>>13
15
Name:
Anonymous
2008-05-06 12:26
i i i i i i i ooooo o ooooooo ooooo ooooo
I I I I I I I 8 8 8 8 8 o 8 8
I \ `+' / I 8 8 8 8 8 8
\ `-+-' / 8 8 8 ooooo 8oooo
`-__|__-' 8 8 8 8 8
| 8 o 8 8 o 8 8
------+------ ooooo 8oooooo ooo8ooo ooooo 8
Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
Copyright (c) Bruno Haible, Sam Steingold 1999-2000
Copyright (c) Sam Steingold, Bruno Haible 2001-2006
16
Name:
Anonymous
2008-05-06 12:32
17
Name:
Anonymous
2008-05-06 12:34
18
Name:
Anonymous
2008-05-06 12:46
>>13
Are you still using Gutsy? Hardy comes with GHC 6.8.2.
19
Name:
Anonymous
2008-05-06 13:57
&do_something if cond;
or
cond and &do_something;
20
Name:
Anonymous
2008-05-06 13:59
>>19
Disregard the second one, I suck cocks.
statement and &do_something;
Fixed.
21
Name:
Anonymous
2008-05-06 14:43
>>18
It also comes with Firefox
3 beta .
22
Name:
Anonymous
2008-05-06 14:45
>>21
You mean it comes with
the best fucking version of Firefox
ever .
23
Name:
Anonymous
2008-05-06 14:46
>>22
That happens to
disable an average of 42,8571429% of an extension ?
24
Name:
Anonymous
2008-05-06 14:51
>>23
Maybe it
disables them because they're
incompatible , so the developers of the extensions should
port them.
25
Name:
Anonymous
2008-05-06 15:04
>>23
One word,
Nightly Tester Tools .
Thread
OVER .
26
Name:
Anonymous
2008-05-06 15:11
Are you guys still using the legacy Firefox 2? I have used Firefox 3 for the last two years.
27
Name:
Anonymous
2008-05-06 15:19
>>26
You're still using Firefox 3? Get the mozilla-central Fx4 builds.
28
Name:
Anonymous
2008-05-06 15:29
>>27
Yeah, I'm actually using the 04-04 Firefox beta ;__;
I should get myself a PKGBUILD that instead downloads the latest nightly tarball like I used to do, but first I'll have to make sure everything is put in /usr and not /opt.
29
Name:
Anonymous
2008-05-07 5:26
int _ = 8==D ;
for (;_;) {_--; Bo( );}
30
Name:
Anonymous
2008-05-07 7:47
>>29
Don't run this code! It's obvious just by looking at it that it will hax your anus.
31
Name:
Anonymous
2008-05-07 9:09
|\|\
|_ _\
|___/
| | r SIGH, it doesn't even compile
| |_____|
SIGH SIGHSIGHSIGH
32
Name:
Anonymous
2008-05-07 9:12
how do I forkbomb in Haskell?
33
Name:
Anonymous
2008-05-07 9:17
>>32
import Control.Concurrent
f = do a <- forkIO g
b <- forkIO g
putStrLn $ "f(): Forked a: " ++ (show a) ++ " and b: " ++ (show b)
return ()
g = do a <- forkIO f
b <- forkIO f
putStrLn $ "g(): Forked a: " ++ (show a) ++ " and b: " ++ (show b)
return ()
some dumbass submitted a bug:
http://hackage.haskell.org/trac/ghc/ticket/1146
34
Name:
Anonymous
2008-05-07 9:21
Isn't there a simpler way using system ?
35
Name:
Anonymous
2008-05-07 9:53
import Control.Concurrent
main = forkIO main >> forkIO main
36
Name:
Anonymous
2008-05-07 11:15
print "Fuck you OP" || die();
print "HAX MY ANUS" && print "HAX MY ANUS";
VALID PERL CODE
37
Name:
Anonymous
2008-05-08 18:43
>>36
He's right you know.
38
Name:
Anonymous
2009-03-06 8:32
The device seeks not to conquer the human nor to be conquered by.
39
Name:
Anonymous
2011-02-27 11:10
> Test
40
Name:
Anonymous
2011-02-27 11:13
> > > > Okay
41
Name:
Anonymous
2011-02-27 11:13
>
>
> Okay
42
Name:
Anonymous
2011-02-27 11:14
Okay
43
Name:
Anonymous
2011-02-27 11:14
Test
44
Name:
Anonymous
2011-02-27 11:15
:GJS1M 67dcbdbce4a0b67c4b48e86a6ae29205a95e4b83024a9d947213d1231800e8d9
:48 748c7c773bc63341711e734e49dab7ff
:1210062420 1298823288
>>17
<-- check my doubles
45
Name:
Anonymous
2011-02-27 11:15
Test
46
Name:
Anonymous
2011-02-27 11:21
> > > > > Test
47
Name:
Anonymous
2011-02-27 11:21
> > > > Test
48
Name:
Anonymous
2011-02-27 11:22
Test
Test
Test
Test
49
Name:
Anonymous
2011-02-27 11:22
Test
Test
Test
Test
50
Name:
Anonymous
2011-02-27 11:23
Test
Test
Test
Test
51
Name:
Anonymous
2011-02-27 11:24
Test> > > Test> > > Test> > > Test
52
Name:
Anonymous
2011-02-27 11:25
Test > > > Test > > > Test > > > Test
53
Name:
Anonymous
2011-02-27 11:42
> > > > > > > > > > >
Oh my.
54
Name:
Anonymous
2011-02-27 12:25
Test </span>
55
Name:
Anonymous
2011-02-27 12:25
:GJS1M 67dcbdbce4a0b67c4b48e86a6ae29205a95e4b83024a9d947213d1231800e8d9
:48 f4ba707282cb2a7da2b0fb566f05b26e
:1210062420 1298827536
>>25
<-- check my doubles
56
Name:
Anonymous
2011-02-27 12:30
57
Name:
Anonymous
2011-02-27 12:34
Test
58
Name:
Anonymous
2011-02-27 12:36
Test!
59
Name:
Anonymous
2011-02-27 12:37
Try2
60
Name:
Anonymous
2011-02-27 12:48
Test
61
Name:
Anonymous
2011-02-27 12:51
Test
Test
62
Name:
Anonymous
2011-02-27 12:52
Test
63
Name:
Anonymous
2011-02-27 13:06
The thingAbout
These quotes
64
Name:
Anonymous
2011-02-27 13:07
The thing
About
These quotes
65
Name:
Anonymous
2011-02-27 13:34
The thing
About
These quotes
66
Name:
Anonymous
2011-02-27 13:34
:GJS1M 67dcbdbce4a0b67c4b48e86a6ae29205a95e4b83024a9d947213d1231800e8d9
:48 03afdcc6134cf2bd3734500dca6c3c0d
:1210062420 1298831645
>>28
<-- check my doubles
67
Name:
Anonymous
2011-02-27 13:35
The thing
About
These quotes
68
Name:
Anonymous
2011-02-27 13:40
The thing
About
These quotes
69
Name:
Anonymous
2011-02-27 13:42
The thing
About
These quotes
70
Name:
Anonymous
2011-02-27 13:44
The thing
About
These quotes
71
Name:
Anonymous
2011-02-27 13:44
The thing
About
These quotes
72
Name:
Anonymous
2011-02-27 14:05
1
2
3
73
Name:
Anonymous
2011-02-27 14:32
1
2
3
74
Name:
Anonymous
2011-02-27 14:36
1
2
3
75
Name:
Anonymous
2011-02-27 14:40
1
2
3
76
Name:
Anonymous
2011-02-27 15:50
1
2
3
77
Name:
Anonymous
2011-02-27 15:51
:GJS1M 67dcbdbce4a0b67c4b48e86a6ae29205a95e4b83024a9d947213d1231800e8d9
:66 2a03a48087b1fc79c033c5868dfb074b
:1210062420 1298839863
>>73
<-- that's cool and all, but check 'em
78
Name:
Anonymous
2011-02-27 15:53
Understanding
the damn
line-break.
79
Name:
Anonymous
2011-02-27 15:55
Damn
this
line-break.
80
Name:
Anonymous
2011-02-27 16:01
1 2 3
4
5
6
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy