Arc Forumnew | comments | leaders | submit | aw's commentslogin

I actually tried GitHub Pages for awwx.ws before I changed to hosting it myself. I don't know if this is still true, but at the time they rendered pages as a batch process: I'd make a change, and some indeterminate time later -- sometimes immediately, sometimes after a long delay -- the change would appear on my web site. I found this killed my productivity.

At this point I'm willing to put in the time to implement a solution that works the way I want it to.

However I wouldn't discourage anyone from setting up a GitHub Pages for Arc today. I hope that my site will turn out to better than GitHub Pages (for this particular purpose), but that doesn't mean that you need to wait around for me to implement something, or even necessarily that you will in fact find my site better than GitHub Pages.

Anything that gets published on GitHub Pages I can import into my site when I actually have something written, so any work you do now in GitHub Pages won't be lost if it turns out that my site does work better. And GitHub Pages are really easy to use and get started with, so there isn't a big time investment needed there either.

-----


Happy to steal anything useful! ^_^

-----

1 point by aw 5469 days ago | link | parent | on: Pattern matching

Indent code blocks with two spaces to have them formatted as code.

http://arclanguage.org/formatdoc

-----

2 points by aw 5469 days ago | link | parent | on: Share your useful functions/macros

My favorite debug print macro:

  (mac erp (x)
    (w/uniq (gx)
      `(let ,gx ,x
         (w/stdout (stderr)
           (write ',x)
           (disp ": ")
           (write ,gx)
           (disp #\newline))
         ,gx)))

  arc> (+ 3 (erp (/ 4 2)) 5)
  (/ 4 2): 2
  10

-----

1 point by aw 5469 days ago | link | parent | on: Share your useful functions/macros

which I hope doesn't irritate aw

Gosh no! Most everything I write is based on code I've seen elsewhere; with either what I hope will be an incremental improvement or else with some minor change to make it fit a personal preference. For me to complain because other people then share their own improvements would be rather foolish... :)

-----


In (fn args ...), args will be a MzScheme list terminated by Mzscheme's '() instead of Arc's nil. It's usually hard to tell the difference, since the Arc runtime treats '() like nil when it can. There are a few odd corner cases where you'll notice it, for example if you use args as a key in a table, it will be a different key value than if you construct the same list using list.

-----

1 point by rocketnia 5471 days ago | link

Ah, right. Part of me's trying to think of a way to use an extensible 'iso (like akkartik's or mine) so it could be used as a table key comparator, but without the burden of maintaining a corresponding extensible hash function. (That is, the hash function would be automatic somehow.) How feasible do you think that would be? Maybe we should have the extensible hash function, but have convenience macros that extend both functions at once?

My main motivation is to remove all traces of the non-extensible Racket 'equal?.

-----

2 points by elibarzilay 5470 days ago | link

Not that it matters much in this context, but racket's equality is extensible: http://docs.racket-lang.org/reference/booleans.html#(def._((...)

-----

2 points by akkartik 5470 days ago | link

That is awesome, thanks for the tip.

Now I want to rant about Racket documentation.

You tell me equality is extensible, and now I know that, and I go look at that page and scan it from top to bottom. I do the usual things I do to read stuff online, and I've been pretty successful with my reading, my reading comprehension scores were excellent in standardized tests, I have a phd that was about nothing if not reading opaque publications, and now I'm faced with this page and I still have no idea how to tell that equality is extensible, or how to go about extending it. If you hadn't told me I'd look at that page about booleans and have no reason to expect it to bear the slightest relationship to equality for complex user-defined data structures[1]. Search for 'extensible'. Nope. Oh, 'inspectable structures.' What the sam hill are those? It has to do with prop:equal+hash, which doesn't even look like a single token to my eyes. Is it a function? How do I use it? All this goes through my mind in a flash, and all I feel is stupid.

I keep waiting for the racket reference to gradually become clear, but it's been a year now of poring over it and I don't think it'll ever happen. It's a blind spot, platform nine and three quarters, just around the corner but at ninety degrees from all three dimensions that I can see. I would never ever have noticed that equality is extensible until you told me that was so.

[1] I scan back up and it's right there in the title: "Booleans and equality." See what I mean about feeling stupid? Why should booleans and equality be grouped together? Why should equality be in the section on datatypes and not say structures?

-----

2 points by elibarzilay 5470 days ago | link

0. Note that the actual link is broken -- it's missing a ")" in the end (it's there, but it wasn't included in the url for some reason (I don't know about the local markdown language...))

1. Yes, some of these issues are known, and we're in a constant race with improving the documentation in various ways. As always, emails to the mailing list or bug reports -- or better: suggestions and possibly patches -- all of these are always welcome.

2. In this particular case, I didn't need to guess -- I knew that it was added, so I just needed to find that reference.

3. But if I were trying to find it, the first place I'd look would be the documentation for `equal?' -- and it is indeed there, at the end of the second paragraph.

4. As for how you use this property, the text that I referred to has a link to "Structure Type Properties", which describes all of that.

5. Re the organization -- booleans and equality are grouped because they're related... It also appears as the first subsection in the datatypes chapter, which makes sense there. If you have an idea how to organize it better, then see #1.

6. Yes, it would be nice to have some section that lists all of the properties that could be used for structs. The main problem with doing this is that it's an open system, so anyone can add more properties, but it won't make sense for the core to list properties from modules outside of it. This was discussed recently, and I don't think that anyone had an idea what to do about it.

-----

1 point by akkartik 5470 days ago | link

"if I were trying to find it, the first place I'd look would be the documentation for `equal?' -- and it is indeed there, at the end of the second paragraph."

Part of the problem is that I never tried finding it, because it didn't occur to me that racket would have extensible equal?

A few months ago I was flattened - absolutely flattened - to find out that PLT has optional args and keyword args. (http://arclanguage.org/item?id=12591)

I have no idea why this is. Perhaps the problem is that people expect scheme to be a small language.

-----

3 points by elibarzilay 5470 days ago | link

Well, the optionals and keyword arguments have been in for a long time now... In fact, the current thing is a second iteration after a first facility that was more CL-like...

In any case, Racket is certainly not a small language...

-----

1 point by akkartik 5470 days ago | link

Yes, as I was ranting I was feeling bad for not having contributed to improve things. I wasn't being rhetorical about feeling stupid and guilty. Lack of understanding is a barrier but no excuse. For me to say "I have a phd, but this I can't read" is akin to saying "I've learned spanish, but chinese is hard." Well, d'uh. Deal.

Perhaps PLT needs a user guide in addition to a reference, a level of redundancy with a kinda orthogonal organization (focusing on complex tasks involving multiple advanced concepts) that'll help people triangulate on understanding, or just use what works for them.

-----

3 points by elibarzilay 5470 days ago | link

Heh, excellent idea: http://docs.racket-lang.org/guide/

(See also other such documents at http://docs.racket-lang.org/getting-started/)

-----

1 point by akkartik 5470 days ago | link

I've seen that before. Why have I not paid more attention?

Here's the extremely clear guide on extensible equality: http://docs.racket-lang.org/guide/define-struct.html#%28part...

I'm going to withdraw my rant. It's something specific about my stupidity that's causing me these problems. Still investigating.

Ah, I think I see what's been happening. Since I started out with arc I've restricted myself to the mzscheme 'ghetto' and not paid as much attention to the racket language itself. My attitude was "who knows what works in mzscheme and what doesn't." This has been the root cause of my troubles, I think.

I'm going to focus on core racket now.

-----

2 points by evanrmurphy 5470 days ago | link

Thanks for the link to Guide: Racket. I've also had trouble getting into Racket's documentation, but this looks like a much more accessible starting point than Reference: Racket.

-----

1 point by rocketnia 5469 days ago | link

(Fixed link: (http://docs.racket-lang.org/reference/booleans.html#(def._((...). I fixed it by putting another pair of parentheses around it to fool the regex. :-p )

Oh, awesome. At one point I think I knew that, too, but at some point I saw 'make-custom-hash (http://docs.racket-lang.org/reference/dicts.html#(def._((lib...) and forgot about it.

Given that prop:equal+hash exists, are there any commonly used convenience macros for implementing it for a structure? It's niftiest if they support cyclic structures too, since Racket's equality API makes that possible, but I'm not picky. ^_^ I'll probably just write something myself either way, but I'm on the lookout for inspiration.

-----

2 points by aw 5475 days ago | link | parent | on: Configuring (nsv)

There are three things you need to do.

First, you have your site running on 74.207.249.155 but you have your DNS set up so that thehackedbrain.com goes to 66.252.1.36. This has nothing to do with Arc; you need to fix your DNS at your domain registrar or at whoever you've delegated your DNS service to.

Second, you need to change site-url* in news.arc so that it reads

  "http://thehackedbrain.com/"
Third as evanmurphy says you need to run nsv so that it's listening on port 80, which is the default HTTP port.

-----

3 points by aw 5475 days ago | link | parent | on: Question: How do I use Arc?

This is a draconian answer, and perhaps someone with more Windows experience can give you other working options to choose from, but honestly, for me personally the easiest way to run Arc on Windows is to install Ubuntu.

You can run Ubuntu inside of Windows (without having to mess around with dual booting or anything) with the free VirtualBox program (http://www.virtualbox.org/) This allows you to run another operating system in a virtual environment... which to Windows, looks like just another Windows program you're running.

My current favorite variant of Ubuntu is Xubuntu (http://xubuntu.com/), which seems to have the least amount of extra windowing junk added in. You download the giant iso file from the Get Xubuntu link (~ 700MB, so it may take a couple hours), and then install it into VirtualBox.

Once you have Ubuntu running, you can go into Applications / Ubuntu Software Center inside the virtual environment, type "plt-scheme" into the search box, and install PLT Scheme.

At that point you can download and untar Arc, and run "mzscheme -f as.scm"

This may seem like a lot of additional work, but an advantage is that when you're ready to deploy your application to a server, you'll already have it working in a Unix environment. And you don't have to deal with various different things annoyingly not working in Windows.

-----

1 point by rocketnia 5473 days ago | link

I've run Arc on Windows for a long time, but having just started into Ubuntu a week or so ago (now settled into Linux Mint), I have to agree with you that it's a pretty good option. ^_^ Most of the trouble I've had has been with getting the network connection to work, and unless I'm mistaken, VirtualBox makes that much less of an issue.

Once Linux is working, getting Arc to work is easy. :-p

-----

1 point by aw 5473 days ago | link

Tell me what you like about Linux Mint? I'd like to recommend a Linux distribution, instead of just saying Ubuntu by default.

Yes, an advantage of the virtual environment is that the work of "drivers" in the virtual environment are actually performed by drivers in the host operating system. So if you have for example networking working in the host environment, then it will also work in the virtual environment... without fiddling around with Linux network drivers for your hardware.

-----

1 point by rocketnia 5472 days ago | link

I want a personalizable interface, I'm very new to Linux, and I don't mind using unfree software like media codecs (something Ubuntu had kept bothering me about ^_^ ), so when I encountered the Linux Mint description at http://distrowatch.com/dwres.php?resource=major, it seemed like a good fit.

Also, I vaguely had in mind that I wanted a theme with hints of green in places (probably because I had seen Linux Mint somewhere before), and the release of Linux Mint 10 happened the day before my search, so it was sorta meant to be. :-p

I had some trouble with both, which Internet searching was mostly able to resolve. But I never figured out the whole too-much-KDE-on-GNOME thing, for instance. @_@

Right now my network connection is really the most annoying thing, but it's passable as long as I'm patient enough to unplug my USB dongle, plug it back in, and reboot until the magic happens. (One reboot's almost always enough.) Usually I'm not that patient 'cause I'm still trying to figure this out, so I fumble with commands like "service network-manager restart" trying to find some combination of them that will actually work this time around. XD It'd be awesome if someone could help me out with this. ^_^;

-----

1 point by shader 5473 days ago | link

I prefer Mint mainly because of the decent looking initial theme, and the superior driver support. I've almost never had any issues getting Mint to install properly with everything working on the first try. Also, the install and configuration process is extremely streamlined and easy to follow. Not that Ubuntu is bad, per se, but Mint seems marginally better.

I'd definitely recommend Mint first for someone not yet well acquainted with linux. The ease of install, simple menu, and software installation tool make it a lot nicer on new users.

I run a virtual boxed Mint in seamless mode on Windows 7 continuously, to use as a shell for ssh and programming in certain languages (like arc or c), and I use a heavily modified Mint on my netbook as well.

-----

1 point by yojimbo25 5474 days ago | link

Thanks for the recommendation, I'm starting the download now. At first I didn't think Windows or Ubuntu would make a difference, but after running into some pretty strange administrator issues with Windows, which wouldn't let Racket access files in other folders, I started having second thoughts..

-----

1 point by akkartik 5474 days ago | link

Yes, I believe the original arc as released here makes no claims of Windows support.

-----


I have a couple thoughts, not necessarily consistent with each other :)

I'm interested in ways that putting code into a module or a namespace is something that I'd do to code that I want to use, instead of something that the library author is supposed to do for me. (That is, something perhaps along the idea of hasenj's load into a namespace idea mentioned in another comment).

Then as a library author, you focus on making your code as clean and simple as possible, instead of guessing how I might want to use it or in what kind of module I might want to encapsulate it in.

Another thought I have is that in human communication, we often use abbreviations (pronouns, nicknames, acronyms), initially describing what we're referring to; for example, I might say "My cousin Bob" and later mention that "Bob is tall" and you know that I'm still talking about my cousin Bob instead of any of the other Bob's that we might know.

So for example in arc.arc:

  (let expander 
       (fn (f var name body)
         `(let ,var (,f ,name)
            (after (do ,@body) (close ,var))))

    (mac w/infile (var name . body)
      (expander 'infile var name body))

    (mac w/outfile (var name . body)
      (expander 'outfile var name body))
    ...
"expander" is a helper function, used only by the public macros, and it's hidden to avoid bulking up the global namespace. I forget what I was working on at the time, but I was amused to notice that I actually wanted to use expander for my own w/something macro that I was writing.

I don't know which of our dwindling supply of ASCII symbols we'd sacrifice for this, but I imagine we might have a kind of abbreviation facility:

  (def (expander{with-file-expander} f var name body)
     `(let ,var (,f ,name)
        (after (do ,@body) (close ,var))))

  (mac w/infile (var name . body)
     (expander 'infile var name body))
the actual name of the symbol is "with-file-expander", while in the context of this load the reader will replace the abbreviation "expander" with "with-file-expander".

-----

1 point by aw 5482 days ago | link | parent | on: QuickCheck for Arc

Looks cool!

I'm not actually able to read the tutorial on my laptop... the paragraphs are wider than my screen, and if I scroll down to the bottom to get the horizontal scrollbar, the paragraph I'm trying to read scrolls up off the screen. Would it be possible to word-wrap them?

Ah, I'm able to read the tutorial in the wiki. Thanks!

-----

More