Arc Forumnew | comments | leaders | submitlogin
Thoughts on arc (syntax)
2 points by gregwebs 5930 days ago | 1 comment
You can still have a false value if nil evaluates to false in conditional expressions.

car and cdr are not intuitive- head and tail are. If you want to compose, just reserve combinations of h and t. htth is shorter than caddar anyways.

we all know cons is magnificent, but syntax support equivalent to haskell would be better.

  lisp     cons item list
  haskell  item:list
Of course, function composition would need to use different syntax. The other great way this is used in haskell is to pull apart a list in the function declaration.

  front_to_back (x:xs) = xs:[x]
This really shortens up code by removing a lot of car and cdr. The problem of what to do for an empty list is easily handled in haskell with pattern matching.

  front_to_back [] = []
Obviously this would be harder to implement in lisp without implementing pattern matching. But I think is is possible in lisp, but you may need a different syntax for pulling the list apart.

  (def front-to-back ((x|xs))
      (if (x|xs) (xs:(x)) '()))
Making Qi's pattern matcher work would probably be better.

Often [.. _ ..] may really just be a way to achieve partial application for a function. In that case,

  (map [+ 10 _] '(1 2 3))
If the meaning of [] is changed to partial applicaion, this can be shortened to

  (map [+ 10] '(1 2 3))
Which actually gets rid of the variable instead of changing it to _

To create an actual function how about

  map \(x (+ 10 x)) '(1 2 3)
use _ abbreviation

  map \(+ 10 _) '(1 2 3)


2 points by lisper 5928 days ago | link

I like FST (first) and RST (rest) with combinations keying on the first letter, e.g. ffrrst == caaddr

-----