Just got stranger. It appears to have something to do with the file name. I copied arc.arc to bja.scm and I could copy/paste. I copied bja.scm to bja.arc and couldn't copy/paste.
So changing the emacs mode has no effect on an existing buffer, but changing the file name does. I guess there's something about a .arc extension that turns off copy/paste from emacs.
edit: another datapoint - everything works fine when running emacs w/o X via: emacs -nw arc.arc
While experimenting, I received the following error after entering the following from the command line:
emacs bja.arc
"File mode specification error: (error "Autoloading failed to define function archive-mode")
You're not dumb. I'm getting the same error, and the error messages aren't very helpful. Apparently, I haven't tried the hello world app since upgrading to arc2.
Anyone have an idea of the problem? I've been looking through news.arc, and came across this:
I prefer the word encourage :) I know it's nitpicky, but the idea was to not simply use a native print. Of course, had I required the 'pp' Ruby lib, I could have just said:
Apparently folks have fixated on a particular algorithm in the wikipedia article. I only linked there for a general description of the problem. Instead, I should have simply said, "write a program that produces all the solutions to the problem of placing 8 queens on a chess board so that no queen is attacking any other queen and prints the solutions as follows (i.e. the output in the OP)"
I'm not too excited about an algorithm that only finds one solution, although it is clever.
Also, if you have the same userid on Hacker News, you could post a note in your profile that proves you've authenticated there which might help with the trust issues.
Sorry, yes. My regular account name is Jesin, but the best proof I can offer is that while I don't have the password the account will remain inactive (unless of course someone else manages to get the password). I use that name for almost all of my online accounts, but I don't happen to have an account at Hacker News yet.
As I said, I think I put my email address on my profile for that account, so if I could access a verification-email-based password recovery system I'd be fine, but for some reason you need to be logged in to do that.
I took sacado's code and tweaked it a bit (Ruby's push appends and Arc's push prepends). Here's the result. If someone can get rid of my joinstr function and make the prn line closer to the Ruby version in conciseness, then I think Arc does pretty well.
For this challenge, it's important to have the output match exactly - that's why the rev is necessary and the complicated print. I do string interpolation all the time in Ruby, so I wanted to see how easy/hard it was in Arc to produce lines such as [ 1, 5, 8, 6, 3, 7, 2, 4 ]
I might as well limit the code to ArcN also.
I think the following may be the only working version of Arc code that passes this challenge so far.
Having to use point is a bit awkward, but not too bad. I particularly like the function composition such as abs:- and the more concise len.stack notation. The [ string sep _ ] notation is definitely a winner also. I'm pretty pleased with the core language so far - kudos to pg & rm.
arc> (help prall)
(from "arc.arc")
[fn] (prall elts (o init ) (o sep , ))
Prints several arguments with an initial header and separated by a
given separator.
Above function also exists in Arc2.
Instead of (point return ...(return ...)) try using (catch ...(throw ...)).
Final nitpick: I think it's rtm, not rm, although, well, I dunno. ^^