00:00 - 20:0020:00 - 00:00

12:45 AM
@NieDzejkob Well it's not.

1 hour later…
1:46 AM
The keyboard works!

@Downgoat HOW did YOU manage to OPEN A MAC and stick your HOOF in the fan???

My PHYSICAL keyboard.
Previously, the entire left side (and the right shift key) were not functioning.

@Christopher2EZ4RTZ Well presumably he was still assembling it at the time.

what keyboard -_-
@Pavel wait how do you assemble mac?
they come assembled

@Christopher2EZ4RTZ Well you buy the parts and screw them together and plug the thing into the other thing and then you install Macintosh.

1:50 AM
@Pavel wat

@Christopher2EZ4RTZ The keyboard that is on my laptop...

@Christopher2EZ4RTZ I'm not sure where this difficulty in comprehension is arising from.

@Zacharý o
@Pavel from the fact that you assemble a mac
goat explain

@Christopher2EZ4RTZ Seriously whats wrong with that

1:52 AM
O_o I bought an aftermarket cooler and the CPU runs like 4x cooler O_o

well what did you expect?

Yep exactly

@Pavel every mac i have seen is sealed in with epoxy and the will of RNGesus

@Christopher2EZ4RTZ I didn't expect $389 CPU to come with such shit fan @Christopher2EZ4RTZ Well, that's why building one was preferable to a prebuilt one. 1:53 AM I don't understand why anoyone would willingly use Macintosh I HAVE BEEN STAR SO MUCH POWERRRRR I'm not a hardware-savvy guy, so ... I'm goat-ally lost here (I'll stop) everything I have seen of it (quite a lot) it seems slow and kinda meh @Christopher2EZ4RTZ Well, I am with you there at least @Downgoat what cpu @Christopher2EZ4RTZ i7 7K 1:55 AM @Christopher2EZ4RTZ Same with windows: the reason is they're forcing you to @Zacharý i don't understand if that was a language i know @Downgoat It's because it's the same fan that comes with the$40 CPU.

@Downgoat goat make moneyyy

@Christopher2EZ4RTZ same reason people willingly use windows

@Downgoat To play video games?

1:57 AM
The only reason people use windows + mac is to either (a) have support for stuff (b) don't know linux exists, or (c) they're forced to use WindowsMac

.—. that is only reason you use windows?

Macs are great for design imo.
I wouldn't mind having one personally, especially to do IOS development stuff.

Solution to any problem: turn it off and on again, and if that doesn't work, install or reinstall windows

I do dualboot beacuse 1) Windows' support for HiDPI is like IE support for CSS 2) Mac can't do game

Mac in fact can't do game.

1:58 AM
CRAP, my slash key doesn't work, because I changed keyboard modes!

also: I got a tiny bit of thermal paste on the side of the heatsink is that bad

@Downgoat Yes

I keep accidentally switching between keyboards and not realizing until it's too late.

@ATaco same

Which really confuses people when my ys become zy and vica versa.

2:00 AM
@Downgoat It's bloody thermal paste what's it gonna do

@ATaco Same, I had 5 keyboards when the left half didn't work

@Pavel idk blow up CPU and cause PSU to blow up causing entire neighborhood to blow up
I live in California, everything catches on fire :P

Two of those are for Esoteric programming.

On my school computer, I have every Cyrillic keyboard layout ever, and mongolian, and every arabic, and two latin keyboards (English and Canadian French)

(Forth one is for Jelly, third is for RProgN2)

2:03 AM
@ATaco ... you program Forth? Didn't know that.
Well, you can get rid of one thanks to Adám

@Downgoat Nope

Quick poll, for the Linux Users here, which distro do you use?

Fedora.

@Zacharý Fedora 27 w/ Cinnamon

Ubuntu. I'm thinking of getting Arch as well, possibly Kali just to say I use Kali ;)

2:06 AM
@Zacharý Debian

I don't know how to install Linux... without a USB or DVD. The Internet doesn't help much.

@user202729 You kinda don't?

@Pavel What do you mean?

@Zacharý It's technically possible to install Linux without a USB or DVD. It's really hard and might make your system unusable.

@Pavel How do you do that?
(I won't attempt that, ever)

2:10 AM
@Zacharý If you need step-by-step instructions, I'm not the one to look for, but basically the idea is you have Linux on another computer and install over the network.

... nope, sounds like a horrible idea ...

That's even a bigger requirement...
45

I want to install Ubuntu on my laptop , that doesn't have a CD-ROM drive , and I have no spare USB disk spare. I've tried Wubi , but that doesn't seem to work (since it prompts me to have the CD in the drive, wich I dont have.) How can I install Ubuntu , easily and in a fast way? P.s: I want it...

but I am using NTFS on the Windows partition and NieDzejkob said that it doesn't work.

@user202729 Wubi is ancient and will probably corrupt your hard drive if you try it.
Even if all the conditions are good

I remembered installing Windows 10 from Windows XP without using USB or CD. That time the Internet was useful.

I've had an idea (never going to implement this) to create a Linux distro (though you might not call this idea that though) that runs completely off of a flash drive and cache.

2:13 AM
@user202729 Well yeah, Microsoft has an executable for that. Like Wubi but functional.

(Solely to circumvent school computers)

When school computers are protected too well, students complains (^) and when they are not protected well enough, students complains about viruses (assuming Windows) and cannot-start-computer issues.

@Zacharý That exists and is called ExtraPC, for people with corrupted hard drives and stuff.

OR some stupid idiot makes a batch virus and gets CMD blocked (one of my friends), or deletes an ENTIRE NETWORK DRIVE (one of my close friends), or spams a drive until we get in trouble (Me and that close friend)

@Zacharý Or takes down the authentication service across the entire district, preventing anyone from logging in (me).
(I installed a pirated copy of Minecraft onto a school computer, and, welp.)

2:19 AM
... that makes me and my two friends seem like weaklings. The closest thing we had to a horrible conspiracy was to mass install Linux (again, never going to implement)
Could you imagine what would happen if the teens from PPCG went to one school district? That would be ... fun ... to say the least.

@Zacharý It was completely an accident.

Any more fun things like that happen? In a bigger school district, there's bound to be more than ~4 computer-savvy people.

Well another time someone got all the printers in the school to show "I KILL TREES"

... holy crap ... I've got some plans for my senior year now!
The worst I've done is put a shutdown bash script in startup (dumb idea, really stupid)

<style>*{display:block}style:before{content:'<style> is a valid HTML quine. Do with this knowledge what you will.

2:25 AM
Another time a friend of mine got a teacher's computer to just say the word HACKED with a pure white bacground for a day

I almost got in massive crap for hacking the school wifi password b/c i know how to do it XD
that is basically it

This was accomplished by plugging the projector into an intel compute stick, so no hacking wizardry was actually done

But when IT came, he switched plugs again, and then IT left, and he made it be HACKED again.

I guessed our schools Wi-fi password back in the day.

2:26 AM
rolf
@ATaco ditto

It wasn't l337t hax or anything but it was really funny.

then they changed it

OH, I remember one time some guy got the admin password ... they had to change it after that.

Our school blacklisted everyone who got on the school teacher only wifi
XD
ThisIsWiFI

Maybe we should conspire to do something insane.
password is my password for all my Linuxes, my uncle set that up for my first linux (now broken), and it stuck with me.

2:28 AM
@Zacharý i wrote a batch file that just made millions of files in the documents computer

I've done that with an excel file ^

lol
if you print the college common application from the web you block the printer

Oh, my friend made this "riddle quiz" that when it ended, it upped your volume all the way and played a, now removed, youtube video that said "Game Over", and it did this like 30 times at once... ahhh, good times, good times.

XD
i have this odd habit of breaking anything

I might be able to post it here. And same here ^

2:31 AM
in Econ my teacher got mad because we botted every kahoot game we played
I got about 5 of us together
so whenever she blamed one they closed their bot net and every else joined
repeat

Our school did that as well, I didn't participate in it.

@Zacharý you mean nothing now

What do you mean?
I've made a JS file that does it, I just never used it.

Kahoot lets your name be a single ZWNJ and after people realized this fact no one had a username again.

2:33 AM
We should definitely try to conspire a cross-district thing, that would be fun.
ZWNJ?

zero width non

My username was always ý, because Czech (orthography) is love, Czech is life

Zero-width non-joiner
It's that character that SE occasionally sticks in the middle of comments for no reason.

I might bring my personal computer (if I ever get Kali installed) and do some stuff ... because why not. It'll probably be my senior year

hah
it is mine you youngin

2:37 AM
Eh, I'm already a year ahead of my school in both math + science classes, so I fit in with those seniors quite nicely.
And our school's comp sci teacher is so damn oblivious!
So ... anything big happen while I was pun-spended?

@HyperNeutrino Which one was problematic? A000109?

Yes.
Progress

https://tio.run/##tVbbbtswDH12voLrk7V6RS7tS7cMSD6gwJ49o1ATtZPtyI6tYO1@vqNIy5fETYcBLVDEIike8vBIdvlifxVm8fr6WBU70FZVtijyGvSuLCoLpap2ByutLkw9mWzVI8htKjfKbF7CzcsmV7W4nQT8BEvgh/g2mQS1/qNay1VZlKGYBDtpK/2M5jieJvAZKOixqOAetIFKmicVOpvABM5Mu52L0yBUoCNII8h8ameBL0uYfYW0@c3oFx2MFuskThOMb5ZpgpZuid6st8yG3vTES6kwe6XsoTLYyABFP4KGT0usReW1gik1l3bN5cqE7QYhEvLrMT86mfBK5fJB5do81f9DeXGw5cE6yhtOZUVQO2Wsw93JMsx1baPBrMPeLITDC6RLYQ9lrsK4lyJW3EM3pUTAyOgQnND3zjRAkpS@qfNKlqUyW6oo3Au4hNjVkIiWcI5jag4GM4QyggeXw09EdQVJNxAFpqBWHxLMR5kfBCfQBgVfq439tzyUg3daZKBG/47rb/ZQ8o7RP7oMP0skkPc8VbL8VYem2PIMMSc9w7clzG/B4yY9z3IJi

@HyperNeutrino Why Python and not Proton?

It would be a (pro)**ton** of work.

@user202729 because itertools is broken in proton and it's much faster in python. I'll probably modify my answer to use Pyon (which is a superset of Python so I can just copy the code :p)

2:52 AM

@user202729 I'm going to do that eventually (if I ever find enough time to redo enough of it to make a substantial fix), but for now I think it's important I get an actual correct solution up there before caird decides to invalidate it and finish the challenge :P

Information: OEIS is down right now.

That seems to happen more often than it should.

that's inconvenient :(
I'm not currently working on my solution to that one because I have some homework and then I need to sleep in a bit

3:00 AM
Are any of the students here taking that ACT Saturday?

@HyperNeutrino I'll take a look at the code anyway. /// Do your homework, leave TNB, it (almost surely) slows down your speed.

good point especially since notifications are a thing :p anyway cya later o/
oh wait before i leave, tomorrow there will probably end up being two advent challenges because unfortunately i had a crammed schedule today and didn't have time to post one. if anyone would like to post advent 7, please feel free to do so because i don't want the chain to break too much :p anyway bye o/
4

^ Star so that other people can see it. (pin notification)

Cya, ಠ_ಠ

Anyone know how to print stack trace in C++ (g++) on _GLIBCXX_DEBUG error?

3:12 AM
C++ has stack trace?

Well, why not?

@user202729 Optimizing compilers would inline most nonrecursive calls.

Not particularly useful, but at least I know on which line is the error.

@user202729 long time no see
hi everyone else

Hi leaky

3:18 AM
wrote a little program that can do ordinals
at least, those that are up to epsilon_0

2 hours later…
5:15 AM
@user202729 How does it compile with no return when it should return int?
CMP: Do you generally close shells with exit, alt-f4, or ctrl-d?

exit

ctrl-d

Alt-f4
(Or the X button)

ew

CMP: How do you open your shells?

5:36 AM
Ctrl-Alt-T
alt+f2 tilix

6:04 AM
@Pavel Well, why not? By convention the return value is put in eax (or equivalent), so writing return 123; is (something equivalent to) mov eax, 123; ret;  in assembly. Without setting eax it is always some value, which is why the tip "return by assignment" works.

Intresting.

Huh, TIL.
Is eax (Or equivalent) reset after the return? or could you theoretically have a call at the end and just implicitely pass it's return value?

@ATaco Nah, why reset it?

6:34 AM
-1

Write an assembly program that sorts positive integers. The source file is to be named sort.s The input file is to be named input.txt and will consist of non-negative integers, one integer per line. The output is the same set of integers printed to STDOUT, one per line, but sorted in ascending or...

@Downgoat Not true, Mac can run factorio and that's the only thing I care about so in my mind Mac can do games

@NieDzejkob Factorio isn't a game. It's a job where you don't get paid that decieves you into thinking you're doing something fun.
...says Pavel, playing Factorio.

I don't understand. What's the problem that prevents a computer install Linux by itself?
CMP: Is editing a bad off-topic should-be-on-stackoverflow question to a good challenge on-topic here a good idea?

Depends what the intent of the asker was.

The OP is not seen on this site recently.
@ATaco No, unless there is something need to use it. Just returning doesn't affect registers.

6:53 AM
That seems like a good edit.

What's the point in writing x[:] in Python?
Ok no problem.
Surprisingly this can be searched on Google.
Does it clone the list?

2 hours later…
9:19 AM
1

Problem Draw a hexagon chain x long, each with side of y length Input x - the length of the chain <= 50 y - the length of each side <= 50 Examples x=1,y=1 _ / \ \_/ x=4,y=1 _ _ / \_/ \_ \_/ \_/ \ \_/ \_/ x=3,y=2 __ __ / \ / \ / \__/ \ \ / \ / \__/ ...

@user202729 It does a (shallow) copy of the list: tio.run/##K6gsycjPM/7/…

@user202729 So, yes.

It's important to keep in mind that it only does a shallow copy. The elements are still the same object references, so nested lists will still get modified. You need copy.deepcopy to avoid that completely.

1 hour later…
10:33 AM
@DJMcMayhem (actually it was First Posts that I used to review on SO)

11:01 AM
CMC: Boustrophedonise. E.g. ["Here are some lines","of text for you","to make a","boustrophedon"]["Here are some lines","uoy rof txet fo","to make a","nodehportsuob"] or ["senil emos era ereH","of text for you","a ekam ot","boustrophedon"] (i.e. you decide initial direction)
CMP: Or should I main ^?

Probably.
Jelly: U¹2ƭ€Y

@user202729 Whoa, that's short.

(5 bytes without the Y if use it as monad function)

@user202729 Probably main?

Yes.

11:04 AM
@Adám Actually, 7 bytes: ;r'R*♀ƒ (searching for a shorter way)

Hold off, I'll main.

Sandbox?
[should every question be sandboxed?]

Most challenges should be sandboxed

@user202729 Nah, this one is simple enough.

Simple challenges are more likely to be duplicate?

11:11 AM
@user202729 I don't use the sandbox as duplication checker.

Simple challenges are more likely to be dupes. Complex challenges are more likely to have unforeseen complications. Sandbox everything. There's no rush.
There's absolutely no detriment to sandboxing a challenge before posting it

CMP: If two questions are exactly the same, but have completely different winning criteria, should they be considered duplicates?

17

My question Just Another Polyglot Hacker! was marked as a duplicate of Write a polyglot that prints the language's name. Now, our scoring rules are completely different. Why are they considered dupes?

@user202729 No. E.g. One is golf and the other fastest-code.

Oh ok. (which is what I expected)

11:37 AM
I always find it interesting that we always have a bunch of people in TNB but they don't chat very often
cough Dennis cough

2

Related but very different. A boustrophedon is a text where every other line of writing is flipped or reversed, with reversed letters. In this challenge, we will just reverse every other line, but leave the actual characters used intact. You may chose to reverse the odd numbered or the even num...

@Christopher2EZ4RTZ I don't chat unless there is a reason to.

@dzaima Well that can't happen much :P

11:48 AM
0

Google Doodle Kids Coding-style simulator One input is a list of commands. There are three action commands and a loop construct. There is some flexibility as to the command format: As a string or equivalent: The loop construct should use a pair of matching brackets. The direction commands shou...

12:07 PM
@NewSandboxedPosts I was just going to sandbox this...
Huh, the rabbit dies?

1 hour later…
1:18 PM
@Riker something for you: reddit.com/r/MurderedByWords

1 hour later…
2:18 PM
-1

Print Happy Holidays in brainfuck with as few characters as possible. Here's my naive solution, where I just use the previous character to get to the next character: -[------->+<]>-. #H [--->++++<]>+. #a -[++>-----<]>.. #pp +++++++++. #y -[---->+<]>++. ++++[->++<]>. #H -[--->+<]>++. #o ---. #l -...

@NewMainPosts Dennis FGITW'd this with the closehammer

2:32 PM
1

I once saw on the xkcd fora a format for expressing numbers in an odd way. In this "factor tree" format: The empty string is 1. Concatenation represents multiplication. A number n enclosed in parentheses (or any paired characters) represents the nth prime number, with 2 being the first prime ...

When does the "Review queues" icon have a red dot notification?

@user202729 cause SE is too lazy to make it update properly or something.

2:47 PM
0

<< Prev After some careful analysis, Santa was able to determine the dock size ranges and get the presents into the correct transportation dock. Now, he needs you to help him balance out the transportation carts and place the presents in them in the most balanced fashion. Challenge You will b...

3:01 PM
@user202729 When the number of outstanding review jobs reaches a certain threshold iirc

@HyperNeutrino Probably ÆfÆC$ÐLŒṘṖḊ will work too. oh is that valid output format? cool :D ÆfÆC$ÐLŒṘ€ should work too.
Yes, any bracket is allowed, and other are ignored.
BTW I pinged you ~4 times in OEIS room, if you didn't notice that (sorry for spamming though)

cool :D I'll try to use that to golf it down more. Thanks! :)

because you get too much notification...?
Unfortunately you should only call ŒṘ exactly once. ¡ might work.
ÆfÆC$¡ŒṘ€ probably works. Need more test cases. 3:18 PM @user202729 No I'm just bad at remembering things I'm now 5 days from Fanatic and 31 score from gold code-golf. I think I might end up getting Fanatic first :p I don't answer enough :p 3:49 PM Any idea which format is this? Search for .w file format doesn't help. (this is overkill for the next OEIS sequence, but it is suggested by KSmarts, and I like learning new things anyway - if I failed I will use brute-force solution) (of course it is readable by itself, but some formatting is great) @user202729 I believe that's (La)TeX I also thought so. But how am I supposed to view it? Tried some Latex online sites and it give a lot of errors. ಠ_ಠ I realised how little anon users' input matters. At school today (about 5 hours ago), I edited one of my answers without logging in, I just check the Edit review queue now and it hasn't come up in the queue at all :/ Excessive prevention of spam posting. (just tried on math.se too, it doesn't recognize \.{something} @user202729 Looks like CWEB 4:00 PM Makes sense - the file is even on Donald Knuth's page, and file extension match. Now I need to find a way to render it. Oh well... Programs to Read I write lots of CWEB programs, primarily for my own edification. Right on the first line... Use CWEAVE to get TeX, and CTANGLE to get C No problem, I get it. But this seems to be designed for Linux... 4:19 PM a programmer is using windows, lol I don't want to use my USB for installing Linux... What is change file... I can't understand cweb. Use NUL as change file seems to work. ugh writing unit tests for 300+ components for Ohm is probably one of the most mind-numbing things I've ever done all my commit messages are the same "specs" "more specs" "oh cool, specs" "hey guess what it's more specs" 4:34 PM (probably) compiled it to tex, but it is full of errors now. Currently I get polynum.tex ._. how do I chmod I'm trying chmod -r 777 foo but it says that no file 777 found Oh, nevermind, chmod uses -R for recursive @user202729 Can you elaborate this? @NickClifford are you sure you're not talking about speck (the german word for bacon)? 5:08 PM @flawr oh god I wish @NickClifford hungry? :) 5:20 PM Is today's XKCD about us? 8 @KSmarts sure as hell looks like it is 2 Background I am currently in an AP Comp Sci A: Java class, and I want to start some of my friends on code golfing. I have a challenge from the course, and I would like to see how many bytes the community can do this challenge in. Challenge details: Given two input strings, the main string and... Stupid Jelly, splitting strings at letters rather than substrings ಠ_ಠ 5:40 PM 0 Implement StackSort! stack-exchange-api, internet, code-golf or popularity-contest WIP The alt text for that XKCD says: StackSort connects to StackOverflow, searches for 'sort a list', and downloads and runs code snippets until the list is sorted. Your challenge is to implement StackSor... @cairdcoinheringaahing I bet jelly is innocent, and just trying to do whatever you tell it to do. @flawr The behaviour makes sense, but isn't desired. For instance, this 6:06 PM CMC: Output all words in Jelly's dictionary I have 33 bytes in Jelly :P :p SOGL outputting its dictionary is 5 bytes @dzaima Hehe, I scrolled to the usernames, and noticed that mine's the very last one :P I was going to comment but I was 5 seconds too late lol and I can't ping @dzaima took me a while to figure out that !! was a single byte Clearly SOGL's dictionary is the best as it actually includes jQuery: $("canvas")[0].hidden=false;cp.size(500,500); :P

6:15 PM
@cairdcoinheringaahing I'm too lazy to add proper graphics related functions :p

@dzaima Why is .. in there twice?

@cairdcoinheringaahing Good question. At some point I wanted to add a way to not have each word require a space before it, but never got around to it. .. is pointless anyway though, and even less with a space before it

CMP: Should I force l answers to use the same dictionary for a string compression challenge or leave it up to the answerer to choose whether to use the provided one or not?

I'd go with being specific

I'm torn between the two. On the one hand, allowing any dictionary is less restrictive, but also allows people with better dictionaries to have an advantage

6:22 PM
(either specify which dictionary, or place very specific criteria on the dictionary they choose for themselves)
Depends on whether you want choice of dictionary to be part of the challenge. People who don't like bonuses and being made to solve the challenge in different ways in order to find which is shortest would probably prefer a fixed dictionary (I don't often answer, but I share that leaning)

@trichoplax Hmm, good point. I think I'll stick with a constant dictionary, as the challenge is more about compression than choosing the right dictionary
Haha, a variation can apply to most good challenges: "Its about the challenge, not about using the right language/resource/whatever" :P

Yeah there's no way around that except for language specific challenges... Which language, which version, which OS, which specific machine...

@cairdcoinheringaahing I'm asking because you know jelly: do you understand what they ask?

@flawr Yeah, he's asking whether it's valid to hardcode the function, or if you have to take it as a string and evaluate it

@cairdcoinheringaahing Ah so that falls under the standard IO.

6:31 PM
f=lambda a:<whatever>
g=lambda a, i:<submission>
print(g(input(), f))
Would be the python equivalent
@flawr Yes, if I understand him correctly

I think I'm gonna post the challenge then probably soonish. Perhaps.
What is the difference between and ?

well, the former includes non-integers I suppose

anyone know mathjax?
^

so is 3.1415 a number?

6:42 PM
Do we go with the most specific tag where one is a subset of the other? Or try to use both if there's room?

@flawr yes
@trichoplax different people have different opinions

@flawr I was going to jokingly say the difference is that an integer can be non-positive, but I think most people would take "number" to including non-whole numbers in this context

and numbers can only be >0?

Well I just noticed that I'm started interpreting the word number a little bit differently since I got in contact with number theory.

@EriktheOutgolfer I would have been joking about the natural numbers, which are either positive or non-negative depending on who you ask and what time of day. But numbers in general can be non-whole and negative, in common usage. I wouldn't expect it to include complex numbers or other extensions unless specified (I'm guessing that's much the same for most people but not sure)

6:48 PM
I would say a complex number falls under "number" but I think a lot of the time when people say number they don't necessarily mean to include complex or imaginary

I guess it's best to use a more specific term (at least somewhere in the spec)

Unrelated but people will also misuse a lot of terms too. In physics people will say "finite" to mean nonzero and it really bothers me. It's so pervasive that even in published papers when people mean nonzero more than half the time they say finite

0

Given an integer x1 and some black box function f: ℤ → ℤ find a fixed point of f in the sequence defined by xk+1 := f(xk). Details A value x is said to be a fixed point of f if x = f(x). For instance if f(x) := round(x/pi)and we have a starting point x1 = 10 then we get x2 = f(x1) = f(10) = ...

7:45 PM
@Dennis Out of curiosity, why is this locked?

1

There has been a well-established meta consensus that people should try not to upvote trivial answers, but it is difficult to post reminders of it if it is not included in the OP. The most effective way to alert the viewers would be to directly comment under those posts, but it doesn't really ma...

Anyone here good with SQL? I have a predicament where I have a function definition that needs to reference a table, but the same table uses the function in a constraint. So creating either entity fails because the other doesn't exist yet.
How to solve ._.

that sounds confusing
i wouldn't say i'm good at sql
but i can take a look

CREATE FUNCTION board_exists(id INT)
RETURNS BOOLEAN AS
$$SELECT EXISTS (SELECT 1 FROM boards WHERE boards.id = id LIMIT 1);$$ LANGUAGE SQL;

CREATE TABLE IF NOT EXISTS boards (
ismain   BOOLEAN CHECK (ismain IS NOT NULL)                                        DEFAULT FALSE,
parent   INT CHECK (ismain OR board_exists(parent))                                DEFAULT NULL,
id       SERIAL CHECK (id IS NOT NULL) UNIQUE,
name     VARCHAR(20) CHECK (name = LOWER(name) AND name IS NOT NULL) UNIQUE,
(Postgre SQL)

@Pavel Add the constraint after creating the function?

7:51 PM
^

@Mego Um, how do I do add a constraint to a column after the table exists already?

@Pavel What flavor of DB/SQL are you using?

ALTER TABLE foo
CHECK  (bar = 0)