Arc Forumnew | comments | leaders | submit | tokipin's commentslogin
1 point by tokipin 6330 days ago | link | parent | on: using scheme libraries

is there any way to implicitly quasiquote in arc2.tar? curious because that would be useful for one of my macros

-----

3 points by absz 6322 days ago | link

From Anarki:

  (mac $ body
    " Allows access to the underlying Scheme. "
    (list 'seval (cons 'quasiquote body)))
In other words, it generates a literal list containing 'quasiquote; when this is evaluated, it looks like (seval (quasiquote body0 body1 ... bodyN)). This technique is perfectly valid Arc2.

-----

1 point by tokipin 6330 days ago | link | parent | on: Nondeterminism

for those of use who'vn't a clue what this is, what does "amb" mean? ambivalent?

-----

2 points by rincewind 6330 days ago | link

It means ambiguous

-----

2 points by tokipin 6330 days ago | link | parent | on: New types in Arc?

i'm not sure i understand, but there is obj and deftem:

http://arcfn.com/doc/table.html#obj http://arcfn.com/doc/template.html

macros are pretty good for language-type thingies since they let you parse the raw input. this could be done as an interface layer on top of the actual mechanisms so you could write things like:

  (logic A -> B
         A)
or whatever the notation is

-----

3 points by tokipin 6331 days ago | link | parent | on: Arc3.tar

perhaps we can make an 'official' branch on anarki, one that would be guided by pg. so that if he says "add forward closures" or "implement a basic math library" the anarkists can go ahead and do that. because a lot of these features aren't exactly simple or quick to implement, so it may be better to just let pg be the overseer on a lot of them

what do you guys think about something like that?

-----

2 points by lojic 6330 days ago | link

I think you're directing your question to the wrong audience.

I also find find the statement: "we can make an 'official' branch" amusing :)

-----

1 point by tokipin 6330 days ago | link

i know there is already an 'official' one on anarki. i guess it could just be a continuation of that one

-----

1 point by lojic 6329 days ago | link

No, there is not an 'official' one on anarky - that's the point. The only official one is Arc2.tar, and I wouldn't expect the next release anytime soon.

-----

2 points by tokipin 6327 days ago | link

odd. i thought there was a branch that was just bug fixes for Arc2

-----

2 points by almkglor 6327 days ago | link

It's called "stable" ^^

-----

1 point by sacado 6330 days ago | link

That's a good idea, and I think that will eventually be how it will work. But I think it's too early for that : obviously, he wants to completely design & implement the core functions (alone) before working (and let other work) on libraries.

-----

1 point by tokipin 6342 days ago | link | parent | on: IDEA: Loading remote files

funny, i was thinking about something like this today. manually downloading/installing libraries is annoying for the programmer, and when they want to release their program they have to either package the libraries or tell people they have to download additional things

instead, it would be nice if the libraries were automatically downloaded the first time they are encountered, so that the programmer could just distribute their file(s)

linux does packaging thingies now... though i haven't used linux in a few years so i dunno how it works. we can allow the programmer to not only specify a library, but also a hash to make sure it's the precise desired file

-----

4 points by tokipin 6346 days ago | link | parent | on: Idioms for programming in Arc

i'd say just take it easy. no need to hurry or anything

here's something from my experiences: a few times i have released things, and not responded to questions/comments about them for some time. not because i didn't care, but actually because i cared too much. to the people, those things were interesting curiousities, but to me they were things that my reputation was attached to. and so i felt that my statements, responses, and actions had to be well-calculated. and i had to consider the things themselves, which even by their lonesome were no walks in the park. it was somewhat daunting, which led to procrastination

not saying this is exactly the case here, but i remember this footnote: http://www.paulgraham.com/startuplessons.html#f2n

so yea, just relax imo. let the creators work things out at their own pace

-----

6 points by tokipin 6349 days ago | link | parent | on: Bug?

originally i was gonna say it might be an artifact of the autodestructuring of arguments, but:

  arc> '(1 . 2 . 3)
  (2 1 3)
which reminded of a topic here regarding mzscheme and infix notation. apparently mzscheme uses the dot for infix, so:

  (a . + . b)
is the same as:

  (+ a b)
as you can see, this works directly from arc. so your function definition is the same as:

  (def huh? (n2 n n3) (prn n n2 n3))
i'm quite proud of myself for figuring this out

-----

2 points by offby1 6349 days ago | link

As well you should be -- that's pretty subtle.

-----

2 points by utx00 6348 days ago | link

well done. someone give tokipin a cookie!

-----

1 point by fil340 6349 days ago | link

Thanks, that was driving me up the wall!

-----

4 points by tokipin 6352 days ago | link | parent | on: get nbr of args for (defun x(a . b)...

b there is just a standard list, so:

  (len b)
http://arcfn.com/doc/list.html#len

-----

1 point by tokipin 6357 days ago | link | parent | on: Macro trouble

here's a macro that prints them out more telligibly:

  (mac pr2 args
       (let l (len args)
         `(do
            (pr ,@(firstn (- l 1) args))
            ,(last args))))

-----


you can use the . as meaning "rest"

  (def sqnl (a b . c) ...)
this is a function that takes a mininum of 2 arguments. when called, the extra arguments are combined into a list and bound to c

for full variadic functions, you can just leave off the parens:

  (def sqnl args
      (map [* _ _] args))
a really nifty thing is that the arguments are automatically destructured (dunno if that's the term.) for example, say you are using lists of two elements to represent points on a coordinate plane:

  (= p1 (list 30 50)
     p2 (list 20 80))
and say you want to make a function that multiplies the points by a scalar. you can do it like this:

  (def scale (point s)
       (list (* s (car point))
             (* s (cadr point))))
so you're explicitly accessing the first (car) and second (cadr) parts of the list. but you can have the work done for you like so:

  (def scale ((x y) s)
       (list (* s x)
             (* s y)))

-----

More