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

I don't think we've received this question before, but try starting them on separate ports and use apache or nginx rewrite rules to map say <site>/blog to the new port. Do you already use apache or nginx to hide the port in the url?

-----

2 points by iancarroll 4650 days ago | link

No, I'm going to set that up. Ok, thanks!

-----

2 points by akkartik 4655 days ago | link | parent | on: Create a "sticky" post in news.arc

The list of stories on the frontpage is generated by the function topstories. That's where you'll want to join a sticky post, either hardcoded or saved in a separate file like the arc/news/topstories file.

Disabling comments seems a little more involved. You'll need to add an attribute (say allowcomments) to the item deftem, and then check for it in:

a) displaying the commentlink in display-story, and

b) comments-active, which is checked before displaying the comment-form

Let me know if this makes sense. If you get it working, send a pull request to https://github.com/arclanguage/anarki!

-----

2 points by thisisdallas 4655 days ago | link

Ok, great, thanks for reply! I'm still really new to arc so, to be honest, it doesn't really make sense without looking at the actual. Hopefully, later today/this week, I will have some time to sit down and really look into things. Once I get something functioning I will definitely send a pull request.

-----

1 point by akkartik 4655 days ago | link

Great. Definitely ask us more questions as they come up. I wasn't sure how much you already knew but we can dig into details as you need them.

Also, you might find this site useful for documentation about join and other arc vocabulary: http://arclanguage.github.io/ref/fnindex.html

-----


Wow. Is there a way to see the other 4 projects?

-----

1 point by zck 4656 days ago | link

Well, one other one is brianru's oauth library (http://arclanguage.org/item?id=17925), but I don't think it's publicly released yet. Not to be too stalkeresque, but it's not on his Github (https://github.com/brianru?tab=repositories).

Lisp In Summer Projects hasn't made a list available that I know of. Certainly they will announce the winners; I don't know if they'll announce all the projects. Hopefully.

-----

3 points by akkartik 4668 days ago | link | parent | on: Could not open a link in a new window

Ah yes, the legal attributes for different html tags are specified by the attribute macro in news.arc: https://github.com/arclanguage/anarki/blob/f17c3d2016/lib/ht.... Try adding a similar line:

  (attribute a target opstring)
Here's a more comprehensive fix I made in my repo: https://github.com/akkartik/arc/commit/d7f9b05463#diff-1. I'll update anarki later today or tomorrow, but feel free to send me a pull request :)

Update: it turns out this already works in anarki (thanks to Mark Huetsch): https://github.com/arclanguage/anarki/commit/8fb05f1383#html.... Where did you download arc from, codepapa? Please take a look at https://sites.google.com/site/arclanguagewiki for better-supported versions.

-----

1 point by akkartik 4668 days ago | link | parent | on: Elm 0.9: reliable static typechecking

Yup! I looked for it a bit, couldn't find it, tried to post the top-level website, got caught by the dup detector, and ended up posting the thread that brought it back to my attention :)

-----

2 points by akkartik 4671 days ago | link | parent | on: Help me customize news.arc

Yeah these are good suggestions. The "address already in use" error suggests that you might have multiple copies of arc running, so that you're making changes to the wrong copy. Use the commands 'ps' and 'kill' to look for the other copies and stop them.

http://stackoverflow.com/questions/3510673/find-and-kill-a-p...

-----

2 points by pier0 4671 days ago | link

I used the command ps aux | grep 'news.arc' and it returned only one copy running, but I suspect that's not right.

And your comment about multiple copies also got me thinking that from the main Arc directory to go into the Arc prompt maybe I shouldn't have been using $ mzscheme -f as.scm

Was I supposed to use that just once to run news.arc for the first time?

-----

3 points by akkartik 4671 days ago | link

No, you want to run:

  $ ps aux |grep mzscheme
ps doesn't know about news.arc, that's just one of the files loaded by mzscheme.

I didn't understand the second and third paragraphs. Can you tell me more about what version of arc you downloaded and how you're running it?

-----

2 points by pier0 4670 days ago | link

I did as you suggested and found a second process running, Then I run this

kill $(ps aux | grep '[m]zscheme' | awk '{print $2}')

and it killed one. After it was just a matter of starting-restating Arc with the changes in news.arc.

And next is the logo. Thanks for your precious advice.

PS In the previous post I was starting to doubt that I'm not supposed to use mzscheme -f as.scm as a command to get to the Arc prompt

-----

2 points by akkartik 4670 days ago | link

Great!

Out of curiosity, how do you stop the server once you start it?

-----

2 points by pier0 4666 days ago | link

I eventually connected the problem with the multiple copies of Arc running with having a detached screen, so I stopped that and closed the terminal.

After doing so the news site was down, which I believe is what Thaddeus was recommending to happen.

Then I had to restart it and detach the screen and start the process again.

It is not ideal, but I think it works.

-----

2 points by thaddeus 4666 days ago | link

Assuming you're using 'GNU screen' you also have the option to re-attach to an existing session using the 'screen -r' command. Using 'screen -ls' will list out all the sessions should you not be sure, or have more than one.

That aside, most developers will do development changes on a local machine where they need not attach/reattach and this way you wouldn't need to troubleshoot your code and the host environment at the same time.

Then you create a stable deployment process. eg. Backup the old code, drop in the new code, re-attach to the existing session and either load your changes or restart the program if you're ok with some nominal downtime.

Hope that helps.

-----


But anarki has a unit test framework already: https://github.com/arclanguage/anarki/blob/7415f52cdc/lib/ar.... It also has some intermittent unit tests, e.g. https://github.com/arclanguage/anarki/blob/7415f52cdc/arc.ar...

Did you mean in some other language? It's easy to build a test harness, it's usually the first thing I do with a new language, and invariably just a few lines of code.

Here's my test harness in C++, for example: https://github.com/akkartik/wart/blob/cc70d66ee6/literate/00.... Even in C++ it's just 50 lines or so. Dynamic languages are often even shorter.

(It's not a normal C++ project. I use readable diff directives inside :(..) to add the test harness to the skeleton program at https://github.com/akkartik/wart/blob/cc70d66ee6/literate/00.... But now that this is done, any function I write with 'test_' is automatically run in test mode. Look at the makefile to see how I do that with minimal code.)

Anyways, tell me what language and I'm sure we can get you quickly past this hurdle.

-----

3 points by zck 4678 days ago | link

Honestly, there are some fiddly bits about the unit test framework I don't like, but mainly I wanted to write one.

I actually applied with it for Lisp In Summer Projects (http://lispinsummerprojects.org/), which is why I haven't announced it -- you're supposed to do the work yourself, without help. And people here like to help out and post code. :-p

Luckily, at this point it's got the main features I want, so I can actually use it.

-----

3 points by brianru 4678 days ago | link

Sweet. I had been wanting to play around with the unit test code too -- i'm excited to see what you've put together.

The oauth utility is also for the LISP contest -- we'll see how far I get over the next few weeks.

Either way I'm planning on uploading a few bits and pieces to Anarki or my own repos over the next couple of weeks. (spent some time on anarki's web.arc, the state machine stuff, oauth, some lazy evaluation stuff, etc...)

Once it's all up I'd love some help!

-----

4 points by zck 4678 days ago | link

Well, if it might be useful, let's do it. https://bitbucket.org/zck/unit-test.arc

Please let me know what you think -- email in profile, comment here, open bitbucket tickets, find me on the street^1, etc.

[1] Actually, after writing this, I read your profile, and found you're in Hacker School. I'm in nyc too -- we should meet up sometime. Shoot me an email.

-----

1 point by akkartik 4677 days ago | link

That makes sense :) I'd love to hear more about what's fiddly about the existing version (I have different versions at http://github.com/akkartik/arc, etc.) and why you need the features (suites, nested suites, failure messages, anything else?)

-----

4 points by zck 4677 days ago | link

I'm going to have to go to bed soon, as I need to wake up in eight hours and twenty minutes, and I've promised myself I'm going to try to sleep enough, for once.

So I'll just explain what, in my mind, is the biggest difference -- how I want to use it. To run the anarki test-iso test, you execute the entire `(test-iso ..)` sexp. If you want to run a bunch of tests, you have to execute all the sexps.

That's kind of a hassle. Especially if you find a bug, have a bunch of tests that fail, then change a small thing in the function, and want to re-run all the tests.

In my unit-test.arc, all you have to do is call `(run-suites suite-name)`, and it'll run as many tests as you've got in `suite-name`. You don't have to copy a bunch of sexps into the repl or reload the file (and what if you want to run a subset of a file? You can't). Also -- and this is one of the features I'm currently working on (https://bitbucket.org/zck/unit-test.arc/issue/21/after-runni...), what if you run one hundred tests at once? Do you really want to parse -- with your eyes, like a bloody scribe -- every single line of output to find the seven tests that broke? And when you then make a fix, you're not going to want to parse them again, so you'll only run the seven that failed before. So if you broke something else, you won't find that out.

So, what falls out of my desire to run a set of tests easily and repeatably, and have summarized output? Some sort of grouping, with a single point of entry to run the tests -- that is to say, test suites.

Please correct me if I've missed any feature of Anarki's test framework. I did read its code and try it, but I didn't look into other files for supporting functionality.

-----

2 points by akkartik 4677 days ago | link

Thanks! You're absolutely right, I've had every single one of these problems, I just never focused on them. But I'd often comment out a bunch of tests in the middle of debugging just one.

(brianru also reminded me that arc has a whole new recent unit-test framework with suites: https://github.com/brianru/anarki/commit/b62a38ebcd via https://github.com/arclanguage/anarki/pull/15)

-----


The issue is with automaton; you're trying to use a macro (mkrule) like a function with map1. Did you turn mkrule into [mkrule _] because you got this error?

  Can't coerce  #(tagged mac #<procedure: mkrule>) fn
Simply using square brackets isn't going to fix that.

---

In general, creating macro helpers for macros is harder to debug. Instead create function helpers to create the right code as a list and invoke it within the top-level macro to turn it into code. Here mkrule should probably be a function.

(This is what people usually mean when they say *don't overuse macros". And then the dictum gradually gets over-generalized into "macros bad" and finally, "lisp? blub blub.")

-----

2 points by brianru 4680 days ago | link

Yep, that's what I did. Thanks for the advice akkartik -- that seems like a simpler pattern to follow.

I'm still finding that line between functions and macros :)

-----

1 point by akkartik 4683 days ago | link | parent | on: Rark - An Arc inspired Racket language.

Can you point out the most disagreeable changes? :)

-----

2 points by rocketnia 4683 days ago | link

Good error reporting is pretty disagreeable to me, lol. :-p

I think Arc's main advantages over Scheme, once all the Arc-like naming conventions and macros are in place, are setforms, defcall (not in pg's Arc), and the ssyntaxes (a:b c), a.b, and a!b. Going by the examples, Rark has setforms, and its ability to unwrap data structures using function calls indicates defcall wouldn't be hard to add if it isn't there already, but I don't see anything about ssyntax. I've been meaning to download and run Rark to see if ssyntax support is actually there after all.

The abstract "Scheme" I'm talking about might have a certain advantage over Racket, but I might just be doing it wrong: Is possible to write a macro and use it in the same file? I've had to break my utilities into three files just to have multiple layers of macros. I'm interested in seeing whether Rark makes this any easier.

-----

2 points by kogir 4683 days ago | link

It's currently missing extensible setforms, but all the standard ssyntax and brackets should work. They're detected and expanded (awkwardly right now) at the reader level.

-----

3 points by kogir 4683 days ago | link

It's hard to say since Arc doesn't have a formal spec. The end goal is for everything to just work like it would in pg's Arc. I'm slowly working toward that goal.

Right now, Arc s-exp editing macros are straight-up unsupported. In addition to pattern matching, you have to explicitly break hygiene with leak and bind:

  (mac nif (test body ...)
    #:leak (nit)
    (bind (nit test)
      (if nit body ...)))
  
  > (nif 5 (displayln (+ "yep: " nit)) (displayln (+ "nope: " nit)))
  yep: 5
  
  > (nif nil (displayln (+ "yep: " nit)) (displayln (+ "nope: " nit)))
  nope: 
There's more I'm sure.

-----

1 point by akkartik 4684 days ago | link | parent | on: Why do old/odd languages appeal to me?

BTW, a friend mentioned that APL does indeed have an 'english' mode as a debugging aid. Perhaps it's indicative that people are using the more concise notation in spite of the availability of alternatives.

-----

2 points by zck 4684 days ago | link

I wonder if it's treated as a second-class citizen, or if you can easily switch between the two.

-----

More