Arc Forumnew | comments | leaders | submit | akkartik's commentslogin
2 points by akkartik 3743 days ago | link | parent | on: Best place to learn Arc?

Can you give more details? Do you have some prior programming experience? Do you mean in-person, in a classroom, online or something else?

I spent some time teaching programming using arc (might not be what you're asking for): http://arclanguage.org/item?id=19039. However, after some time I ended up moving away from arc: http://akkartik.name/post/mu. If you have some programming experience already, though, that might not be for you either.

-----


Can you share the error you get and the c file so I can try to reproduce?

-----

3 points by akkartik 3760 days ago | link | parent | on: Why parents?

"We can't parse ... unless we know all the operators that it uses."

Yes, that was my reaction as well. I thought https://en.wikipedia.org/wiki/Polish_notation requires either a clear separation between operators and values (so no higher-order functions) or all operators to be binary. Parentheses (whether of the lisp or ML or other variety) permit mult-iary higher-order operations.

Also, doesn't https://en.wikipedia.org/wiki/Shunting-yard_algorithm require some sort of delimiter between operations? I thought it didn't work for nested operations without commas or parens, or the simplifying assumptions in the previous paragraph.

-----

2 points by rocketnia 3760 days ago | link

I think those simplifying assumptions are consistent with what dagfroberg was saying. I think "Polish notation" and "shunting-yard algorithm" make sense as terminology here, even if dagfroberg and I might each have slight variations in mind.

---

"so no higher-order functions"

I think we can get read-time arity information for local variables, but only if our read-time arity information for the lambda syntax is detailed enough to tell us how to obtain the arity information for its parameter. For instance...

  -- To parse 3: We've completed an expression.
  3 =:: Expr
  
  -- To parse +: Parse an expression. Parse an expression. We've
  -- completed an expression.
  + =:: Expr -> Expr -> Expr
  
  -- To parse fn: Parse a variable. Parse an expression where that
  -- variable is parsed by (We've completed an expression.). We've
  -- completed an expression.
  fn =:: (arg : Var) -> LetArity arg Expr Expr -> Expr
  
  -- To parse letArity: Parse a variable. Parse an arity specification.
  -- Parse an expression where that variable is parsed by that arity
  -- specification. We've completed an expression.
  letArity =:: (arg : Var) -> Arity n -> LetArity arg n Expr -> Expr
  
  -- To parse arityExpr: We've completed a specification of arity
  -- (Expr).
  arityExpr =:: Arity Expr
  
  -- To parse arityArrow: Parse a specification of some arity m. Parse a
  -- specification of some arity n. We've completed a specification of
  -- arity (Parse according to arity specification m. We've completed a
  -- parse according to arity specification n.).
  arityArrow =:: Arity m -> Arity n -> Arity (m -> n)
  
  -- ...likewise for many of the other syntaxes I'm using in these arity
  -- specifications, which isn't to say they're all *easy* or even
  -- *possible* to specify in this metacircular way...
This extensible parser is pretty obviously turning into a half parser, half static type system, and now we have two big design rabbit holes for the price of one. :)

Notably, Telegram's binary protocol actually takes an approach that seems related to this, using dependent type declarations as part of the protocol: https://core.telegram.org/mtproto/TL

-----

3 points by akkartik 3766 days ago | link | parent | on: Website with arc

You would have to write code in Arc or Racket, I think. In common lisp I see http://www.cliki.net/cl-eshop on http://www.cliki.net/web.

For hosting there's tons of cheap unix VPS providers. Not much differentiating them; just go with one, and you can switch if you don't like it. Start with https://linode.com or https://www.digitalocean.com.

-----

2 points by akkartik 3807 days ago | link | parent | on: Parallelism and Data Oriented Design

Nice! I should warn you that arc is very deeply permeated with the assumption that there's only one thread of execution. See atomic, for example, which all the assignment operators use: https://arclanguage.github.io/ref/atomic.html. Couple with the statement that "The distinction between “future safe” and “future unsafe” operations may be far from apparent at the level of a Racket program," (http://docs.racket-lang.org/guide/parallelism.html) and I think you might be in for some interesting debugging times :)

Hmm, future-event seems like it's just for performance logging? Maybe ignore it for now and try to build something non-trivial with the primitives you have?

-----

2 points by cthammett 3805 days ago | link

Thanks for the tips, I'll keep on exploring the possibilities. On a side note, is there a c or python ffi for Anarki?

-----

2 points by akkartik 3805 days ago | link

In the past I just used the Racket FFI for C with anarki's $ operator.

Hold on, let me throw up this arc project of mine from many years ago. The FFI isn't on head, but here's how I imported a Porter stemming (https://en.wikipedia.org/wiki/Stemming) implementation and a keyword-guessing algorithm in C: https://github.com/akkartik/readwarp/blob/e281ecfefd/keyword.... C functions that that invokes: https://github.com/akkartik/readwarp/blob/e281ecfefd/keyword...

(There's a password for my mail delivery service in that repo, but that account is now defunct. Hopefully nothing else is confidential. Please be nice and let me know if you see something there that might damage me :)

-----

2 points by cthammett 3802 days ago | link

Thanks, I didn't see anything suspect. It should be a good learning experience calling c from Anarki. I saw a tutorial today how to create c callable functions using NASM x86-64 assembly code and it worked. Do you think assembly and Anarki can talk to each other through c?

-----

1 point by akkartik 3802 days ago | link

No reason they couldn't!

If you're into assembly I'd love to hear what you think of my current project to teach programming using a sort of idealized assembly: http://github.com/akkartik/mu. I'm co-designing the assembly language with the OS around it, in the spirit of C+unix.

-----

2 points by cthammett 3801 days ago | link

The project looks interesting. I would like to learn more about assembly to, have greater understanding and control over what my computer actually does. All the tests passed but I made mu crash using repl.mu, if this help in finding bugs?

  ./mu repl.mu
  ready! type in an instruction, then hit enter. ctrl-d exits.
  (+ 1 1)
  missing type in {name: "1", properties: ["1": ]}
  mu: 041name.cc:82 bool disqualified(reagent&): Assertion `!x.types.empty()' failed.
  Aborted (Core dumped)
Also my left, middle and right mouse button clicks were printing rubbish to the terminal after that. I restarted the terminal and mouse functionality was normal again.

-----

2 points by akkartik 3801 days ago | link

Thanks for trying it! It's not actually a Lisp :) Check out the examples in the readme.

The repl is sadly not done. Repl feels like the wrong metaphor. I'm writing on a more useful version in edit.mu, but that's far from done. For now sadly you have to type code into a file and run it as a separate step. Just for a couple more weeks, hopefully.

-----

2 points by cthammett 3800 days ago | link

Impressive project, how long have you been programming for? I'm not sure if I can be of much technical assistance but if you recommend a few tools I could probably learn more about testing and find bugs. Earlier this week I installed valgrind to check for errors and memory leaks and I'm looking for a debugger that will work with lubuntu. I am also learning assembly.

-----

1 point by akkartik 3800 days ago | link

I'm starting to feel old :) I've been programming for 16 years now.

Feel free to ask me more questions. I'm not looking for help, rather to help. But there's still some way to go. In the meantime I'll help in any other way. Valgrind is super useful for C programming.

-----


To try it out (on linux, or Mac with GNU tools):

  $ git clone https://github.com/akkartik/mu
  $ cd mu
  $ make
  $ ./mu chessboard.mu
More information: http://github.com/akkartik. Why I'm working on this instead of lisp: http://akkartik.name/about (tl;dr - I'm building better foundations for runtimes for implementing languages. This has been my long-standing itch: http://arclanguage.org/item?id=17598)

(at git hash dff767144b2)

-----

1 point by akkartik 3850 days ago | link | parent | on: Let Over lambda, Ch 6 Ichain intercept

Remind us, what is alet? I tried reading http://letoverlambda.com/index.cl/guest/chap6.html but it uses vocabulary from previous chapters, like dlambda.

-----

2 points by rocketnia 3849 days ago | link

Hmm, looking at the implementation, 'alet is a utility for wrapping a lambda to do various things:

a) The letargs let you set up some bindings the function can refer to.

b) The body lets you do some things with the function in scope before returning it.

c) It wraps the function in a mutable binding named 'this, and it actually returns another function that dereferences this binding and calls whatever's inside. That way you can dynamically replace the entire behavior of the function by assigning to 'this.

So it seems to be geared for a certain object-oriented style where objects have a) private fields, b) a programmable constructor, and c) a private "become" operation.

It looks like 'dlambda is some kind of a multi-branch, destructuring lambda. In this context of this object-oriented style, it effectively lets your object have multiple methods.

-----

1 point by akkartik 3854 days ago | link | parent | on: On Lisp - Figure 18.5 matching function

Nice! So does it work? :)

-----


Yes this came up before. Try the solution at http://www.arclanguage.org/item?id=17139 and let me know if you still have issues.

-----

2 points by tvvocold 3857 days ago | link

Thx, i had found this [1], but what i really need is a toptable/topic like https://news.ycombinator.com/show (which is diff from 'about' page. (A story whose title begins with "Show HN" goes to /show. FYI [2]))

BTW,it would be nice if Arc Forum got a ask table/topic like https://news.ycombinator.com/ask

[1] https://github.com/arclanguage/anarki/compare/master...flami...

[2] https://news.ycombinator.com/showhn.html

-----


Arc/anarki is more minimalist than common lisp and won't warn you about unused variables, so I think the answer here is: nothing :) Here's the equivalent macro in anarki:

  (mac tree-leaves (tree test result)
    `(tree-leaves%% ,tree ,test ,result))
Might as well call the function directly :)

(And no, this wasn't asked before. I'd never gotten past the first couple of chapters of letoverlambda. Maybe I should go back to it.)

-----

2 points by cthammett 3862 days ago | link

Hey thank you this is very helpful for beginners like me. I am working through it to learn, practice and master the ideas presented in the book.

-----

1 point by akkartik 3862 days ago | link

You're welcome. By the way, if you add two spaces to a line on this forum it won't run through with the next one. Compare these two examples:

line1 line2

  line1
  line2
This is useful when showing code.

Feel free to ask more questions!

-----

2 points by cthammett 3856 days ago | link

Hey thanks for saving me further embarrassment. If I were to ask another question should I start another thread? In particular I am trying to translate to arc a matching function in Paul Graham's On Lisp, Fig 18.5. After this I am hoping to learn about Query Interpreters Fig 19.3 and Query Compilers Fig 19.6

-----

1 point by akkartik 3856 days ago | link

Whatever you like! Don't worry about dominating the frontpage or anything. Feel free to open new threads as needed.

-----

More