Arc Forumnew | comments | leaders | submitlogin
3 points by Oscar-Belletti 3356 days ago | link | parent | on: Arc-nu Ctrl-c exits the repl

It works now.
4 points by Pauan 3356 days ago | link | parent | on: Arc-nu Ctrl-c exits the repl

You're right: there was a minor typo in the repl code. Thanks for letting me know.

I just now fixed it and pushed the changes to GitHub. You should be able to "git pull" and then it will work.

2 points by rocketnia 3357 days ago | link | parent | on: Creating a maze game

Hot on the heels of that Game Maker bundle, now there's a bundle for Clickteam Fusion for the next 14 days: https://www.humblebundle.com/clickteam-fusion-bundle It's the latest iteration of the series of tools that started with Klik & Play in 1994: https://en.wikipedia.org/wiki/Klik

I know someone who's making a game with Clickteam Fusion and considers it almost a form of betrayal to go with GameMaker. :-p So when I brought up GameMaker, I was thinking of mentioning Clickteam Fusion as well, but the usual cost is $99. I don't really know enough about it to know that it's worth that price tag. Now that it's on sale, I guess I'll be picking it up just in case I want to use it sometime, just like the other one.


I started using ansi-term in emacs to launch a shell file which wrapped rlwrap around the file I wished to execute. Turns out that M-x no longer works in that buffer.
3 points by zck 3361 days ago | link | parent | on: How to run anarki as utility, not REPL?

Just echoing that rlwrap isn't needed. I actually added an arg (-n) to arc.sh that doesn't use rlwrap. I use it when running arc inside an emacs shell, because emacs has terminal integration that I prefer.
6 points by jsgrahamus 3362 days ago | link | parent | on: Hosting Arc app on Heroku?

Heroku allows for custom buildpacks.

Also found this article, which may be helpful:

https://lexi-lambda.github.io/blog/2015/08/22/deploying-rack...

4 points by jsgrahamus 3362 days ago | link | parent | on: Accessing Racket from anarki

Thanks, guys. This is great!`

"But, unfortunately the language will be much more constrained if all services must consist of letters. I have an explicit goal that any service name goes except some very few reserved characters. The reason is that it should be possible to create DSL-like APIs with service names like "$", "&", "->", "+", or even "{" and ";"."

Yes, probably you are right here.

"As you have suggested, a solution for this could be to instead check if the service exist at all in the scope."

Yes, actually I thought of having all service names starting uppercase to check if a name is a service faster.

"Service names that do not exist can be assumed to be actions on the @ service. This is a more unconstrained solution. But it means that all actions on @ can never be used as service names."

I think you should be able to shadow @'s names, and then, if you need them, call them with the @.

"This makes a dilemma between unconstrained, small syntax and prettier code with quirky reserved words. Do you agree?"

I think that if you use the approach I just said (you can shadow the @'s names) you wont make your language more constrained. However, yes, you will add new syntax, which you consider a bad thing.

"Now for your other suggestion. Yes, I agree! I have thought about it before, and I think it might have no drawbacks. The fact that you also noticed it makes it even more probable that it is a good solution. The challenge will then be, as you also noticed, how a variable service can be the variable and the value at the same time. I think it is not good enough to simply check if there are no actions on foo, because then foo must always be the last value. I.e. this has to work:"

Yes, it would not be an improvement.

"Can you explain more on how your other solution to this would work? I did not quite understand it."

Imagine a service which supports both int/number's actions and variable actions. You could write:

    foo = 4
and it would call the variable action =. And here:

    foo + 4
it would call the number action +.

However in this case:

    4 + foo
things are more complicated. I looked at your "+" implementation, and it expects that it's argument is a js number. You can make a check, like if the argument isn't a number and it is a service, you try to call a getvalue action, and if it returns a number, you use it. Or maybe change something about accessing the value of an number (or string), but I don't know how services are implemented (yet), so I can't tell precisely.

That is a good idea. And it will make the code much prettier. Here is what I think the fibonacci example would look like:

    var fibonacci :
        var scope :
            var result = (.argument)
            .argument > 1 then
                set result = 
                    fibonacci (.result - 1) + (fibonacci (.result - 2))
            .result
        scope (.argument)
        
    fibonacci 7

    //result: 13
But, unfortunately the language will be much more constrained if all services must consist of letters. I have an explicit goal that any service name goes except some very few reserved characters. The reason is that it should be possible to create DSL-like APIs with service names like "$", "&", "->", "+", or even "{" and ";".

As you have suggested, a solution for this could be to instead check if the service exist at all in the scope. Service names that do not exist can be assumed to be actions on the @ service. This is a more unconstrained solution. But it means that all actions on @ can never be used as service names. This makes a dilemma between unconstrained, small syntax and prettier code with quirky reserved words. Do you agree?

Now for your other suggestion. Yes, I agree! I have thought about it before, and I think it might have no drawbacks. The fact that you also noticed it makes it even more probable that it is a good solution. The challenge will then be, as you also noticed, how a variable service can be the variable and the value at the same time.

I think it is not good enough to simply check if there are no actions on foo, because then foo must always be the last value. I.e. this has to work:

     foo + 4
Can you explain more on how your other solution to this would work? I did not quite understand it.

By the way, if variable services could also represent their value, it should be very simple to implement some sort of lazy evaluation in the language. That would be cool.

3 points by akkartik 3363 days ago | link | parent | on: Hosting Arc app on Heroku?

Hmm, I'm surprised but this question seems to have never come up before over here. Google says the only mention of heroku in this forum is http://arclanguage.org/item?id=19394 which says one of the advantages of Clojure over Arc is that it can be hosted over Heroku.

Please report back if you have success doing so, or what problems you run into. Thanks!

1 point by rocketnia 3363 days ago | link | parent | on: Accessing Racket from anarki

Er, I upvoted your "sorry" just now because I did find it interesting that those archive links exist. :) I guess the Racket project doesn't have such tireless devotion to documentation that they maintain active versions of the docs for old software releases, but it's nice that a snapshot is up somewhere.
4 points by akkartik 3363 days ago | link | parent | on: Accessing Racket from anarki

Just to summarize rocketnia's and Oscar-Belletti's investigations on this thread, do this:

  arc> ($:require racket/list)
  arc> ($:first '(1 2))
  1
2 points by Oscar-Belletti 3363 days ago | link | parent | on: Accessing Racket from anarki

You are right. Sorry for the outdated links.
4 points by rocketnia 3363 days ago | link | parent | on: Accessing Racket from anarki

There should be up-to-date reference information about the mzscheme library here: https://docs.racket-lang.org/mzscheme/index.html?q=mzscheme

As described there, mzscheme exports most of the bindings of racket/base. As described at https://docs.racket-lang.org/reference/pairs.html?q=first#%2..., first is exported by racket/list and racket, but not by racket/base.

(My point isn't to say "you should have known" but to point out what the current documentation is like in case it's helpful for other reasons. XD )

1 point by Oscar-Belletti 3363 days ago | link | parent | on: Accessing Racket from anarki

Thanks!
2 points by akkartik 3363 days ago | link | parent | on: Accessing Racket from anarki

Nice work!
4 points by Oscar-Belletti 3363 days ago | link | parent | on: Accessing Racket from anarki

I think you are right: the file ac.scm starts with:

    (module ac mzscheme
MzScheme doesn't have first.

On the wayback machine I found the docs of 2008 for MzScheme version 372: http://web.archive.org/web/20080511203435/http://www.plt-sch...

There are still MzScheme docs here: http://www.plt-scheme.org/software/mzscheme/docs.html but the links on that page don't work for me, so I found the page on the wayback machine(2009) too: http://web.archive.org/web/20090603011739/http://www.plt-sch...

3 points by akkartik 3363 days ago | link | parent | on: Accessing Racket from anarki

My guess is that it's because even though Arc uses Racket, it's still using its legacy MzScheme language. This works, though:

  arc> ($:car '(1 2))
  1
Though I'm not sure where we can find MzScheme-specific documentation anymore..
3 points by akkartik 3364 days ago | link | parent | on: How to run anarki as utility, not REPL?

Many thanks for your pull request! Support for Windows chronically lags behind Unix, and I'd love to hear about any more bugs you run into on Windows.

rlwrap is just a little program which provides some standard features of Unix shells like commandline history and keyboard shortcuts. It's nice to have but certainly not essential.

4 points by caddr 3364 days ago | link | parent | on: How to run anarki as utility, not REPL?

Thanks jsgrahamus and akkartik!

Your examples are valid in Linux, but I was trying to launch anarki in Windows. So I've made windows batch file arc.cmd following arc.sh. Seems it works now. I have made a pull req to the repo.

...Only thing - how to port rlwrap to windows? And what (for what) is it? Better REPL formatting? :-)

4 points by akkartik 3364 days ago | link | parent | on: How to run anarki as utility, not REPL?

You're almost there. To pass in to Arc a filename argument to write to, you'd say this:

  $ cat test.arc
  (tofile (argv 1)
    (prn "hello, world!"))
(The quit is unnecessary since Arc will automatically quit after running all commands in batch mode.)

  $ ./arc.sh test.arc test.out
  $ cat test.out
  hello, world!
argv is a list containing commandline arguments, and tofile redirects prn to some given filename.

This works for me in anarki, which is the community edition of arc:

  steve@steve-Satellite-L555D:~/anarki$ cat test.arc
  (prn "hello, world!")
  (quit)

  steve@steve-Satellite-L555D:~/anarki$ ./arc.sh test.arc > test.out

  steve@steve-Satellite-L555D:~/anarki$ cat test.out
  hello, world!

  steve@steve-Satellite-L555D:~/anarki$ 
Not sure how to do pass an file name to arc itself.

I have an idea, but I'm not sure it's ok: Since @ is used most of the time, it could be the default. To do that you might make a rule that all services must start with a capital letter(or a number or " or be "true" or be "false"), and only services can. Then you can make:

    foo bar baz
change to:

    @ foo bar baz
while:

    Foo bar baz
Remains the same. If you don't like the idea of every service starting uppercase, you could just check if the word is a service.

Now an unrelated issue, accessing and modifying a variable:

    @ set foo = 4
Even if we ignore the @ (because it's a different problem):

    set foo = 4
It would be better to write just:

    foo = 4
And it makes sense: variable service foo, action =, argument 4. Now accessing a variable:

    4 + @.foo
I should be able to write:

    4 + foo
This is a bit more complicated. To allow the foo = 4 part foo must be a variable service. But in this case it should act as a number service. I see two ways to solve this: or variable services gain new actions based on their type, or when a service is called without an action, a standard action is called, which by default returns the service itself, but can be overwritten, for example in variables, where it returns the variable value.

Thank you for taking the time to look at the language. Yes, I agree that there is a problem with a lot of @s and vars littering the code. A consequence of the small syntax seems to be that working with variables and scope is very verbose. My goal with the language is to keep the syntax very very small, but at the same time be able to express the typical things we expect from modern programming languages. Maybe some syntactic sugar could help. But I am not sure what kind of sugar would work best to avoid all the @s. Any ideas?

And yes, the documentation of system provided services is indeed lacking. I have made an issue for it and plan to address it asap: https://github.com/holgerl/hilvl/issues/9


I think you looked at it a lot closer than I did, and your points are great :)

Interesting link, thanks!

This approach (everything is a service) has pros and cons: with it you can easily overload operators, and it gives you the ability to extend infix notation (while in programming languages with c syntax only the built in language operators have infix notation, and your functions have the functions(arg1,arg2,...) syntax). But hilvl is quite verbose. Usually arguments against static typing include the fact that typing the type name is verbose. In hilvl you have to type two words: @ and var. And to call a function (action) you have to always type the service. This leads to a lot of @, which isn't very good. If you look at the recursion example [1] you will see that every line starts with @. The other two examples, and the server code aren't much better. There should be a trick to have less @'s.

Apart from that, the absence of documentation isn't nice. I wanted to see the IO actions, and I had to find it's definition in the js source.

What do you think about hilvl, akkartik?

[1] - https://github.com/holgerl/hilvl#recursion


Thanks! I remember seeing it yesterday at 1 point and assuming it was done. Didn't notice when people started upvoting it. Oh well, probably too late now.

Love teaching myself.

BTW, this HN link has some traffic: https://news.ycombinator.com/item?id=12501763

2 points by Oscar-Belletti 3368 days ago | link | parent | on: Errors in anarki stable

"Thanks for those comments!"

You're welcome.

I'll certainly tell you if I find some references to the old "arc" name.


Finding better ways to write code that let newcomers make sense of them faster. More details: http://akkartik.name/about

The teaching fits into this in two ways:

a) It seems like a more ambitious test. If I can make codebases easier for non-programmers or inexperienced programmers to understand, then experienced ones should hopefully be easy.

b) It's a way to get feedback. It's hard to find experienced programmers willing to try out a strange new way of writing code that isn't going to be useful in real products for a very long time. Without this feedback I'd be likely to burn out long before I can fully validate or invalidate my hypothesis. But at least for me, teaching is extremely rewarding/addictive.

Oh, there's a third way: since I get paid for my teaching, there's the distant possibility that I might be able to scale up the teaching to fund my research so that I can work on it full-time.

More