Arc Forumnew | comments | leaders | submit | drcode's commentslogin
3 points by drcode 6420 days ago | link | parent | on: One-to-many, many-to-many, etc

I was the one who created the scaffolding system- It does, indeed, generate the code to add/update/etc from a database. I've continued to expand the system on my own, but since there wasn't much interest in the arc forum I decided not to continue checking code into anarki for now, but may again in the future- So right now it is strictly ver 0.01, though I'm surprised others seem to manage without a scaffolding system...

As for the issue of one-many and many-many, I guess I would suggest that in a one-to-many situation I would try and store the "many" as a child field in the "one", not use two separate tables if you can get away with it (one of the advantages of a non-RDBMS is that this design is possible)

As for many-many, I would probably have two tables, then have an extra table that just maps keys to keys for the two tables. Basically, just like an RDBMS association table. (or maybe even a bidirectional table, if you need to go "both ways")

If you want to know the "official" way to store data in different relationships in a simple, purely functional, memory resident database, I'd look at HApps-ixset. This is philisophically closely aligned to what you'd need in arc and is designed by some super smart guys. Unfortunately, their documentation is wanting or I'd point you to a good link that describes how to use it.

Those are some thoughts.

-----

2 points by drcode 6424 days ago | link | parent | on: (/ 0 0.0) = 0

wow- I never would have expected that... It seems that anyone who has a computer program dividing by zero would want an exception raised or at least have an NaN generated. Generating "0" makes no sense- In my scenario, for instance, the function limit was towards 1, so generating a zero is mathematically seemingly completely nonsensical.... Thanks for straightening me out, kens :-)

-----

5 points by stefano 6424 days ago | link

In floating point arithmetic 0.0 isn't zero: it represent a range of numbers around zero, so it makes a little sense for 0/0.0 to return 0.0. I still think that raising an exception would be preferable.

-----

6 points by cchooper 6424 days ago | link

To be pedantic, it doesn't make any sense to return 0.0, but it does make some sense to return 0. I'm sure that's what you meant though.

It's 0.0/0.0 that gets my head spinning. If only 'Whatever' were a valid number.

-----

4 points by Jesin 6422 days ago | link

Well, it depends.

  lim{x -> 0}(x/x) = 1
  lim{x -> 0}(x/0) = NaN
  lim{x -> 0}(0/x) = 0

-----

2 points by drcode 6424 days ago | link | parent | on: "IQ Hacking" in arc

Sure enough, a day after I spent time creating my version of this, someone else created an open source version as well.

http://shawnpresser.blogspot.com/2008/04/brain-rage.html

-----

1 point by drcode 6424 days ago | link

FYI- apparently, noone can get this other app to run without crashing. My arc version of dual n-back has not yet received any error reports and so is hopefully working OK for people.

-----

1 point by absz 6424 days ago | link

I can't get it to work because the sound functionality relies on Linux (and specifically, I think, KDE); I'm on OS X, and (a) I don't have the "play" command (well, I do, but only because I have TextMate; it's nonstandard), (b) I don't have a "/usr/share/sounds" directory, and (c) if I did, I still wouldn't have sounds such as "KDE_Beep_Beep.wav". Other than that, it appears to work.

-----

2 points by drcode 6424 days ago | link

Yes, the software is Ubuntu only, as stated in the post.

-----

1 point by absz 6424 days ago | link

Ack, I missed that :) It's a pity, though, as it's almost not. I'll probably tinker with that line to make it work on my machine, and that should be all it takes. Ah well.

-----

2 points by drcode 6425 days ago | link | parent | on: How would you code this in Arc?

Unfortunately, this is a good arc anti-challenge.

-----

1 point by drcode 6428 days ago | link | parent | on: Idioms for programming in Arc

Yeah, it's definitely been getting a bit quiet in the arc world... I'm planning on using arc long term, so I hope the community survives...

And I second the motion that your docs are extremely useful, kens. I have a bookmark link for them on my main toolbar, along with only a handful of other essential tools on the web. No question though, your audience is unfortunately is pretty small these days...

-----

1 point by drcode 6431 days ago | link | parent | on: Smalltalk vs LISP

Well, I can't write up a big description right now, but they're definitely completely different sorts of things.

The basic way I'd think of it is that LISP lets you do clever things by keeping the core design of the structures inside of the compiler/interpreter as simple/primitive as possible.

Smalltalk lets you do clever things by having the run time system "take care of the hard stuff for you."

...Although maybe this description is overly simplistic.

-----

6 points by drcode 6432 days ago | link | parent | on: Are strings useful ?

I would frame the question differently.

"Strings" are used for communication with a human- Human readable text is an important tool that software uses for interacting with a user.

Inside the actual logic of a program it really has no useful role. It is unfortunate that a byte hold a text character reasonably efficiently, so almost all software uses strings as primary data structures, even though they don't belong in the body of a program.

In my view, strings should only be used in two places in any application: 1. Acquiring raw data from the user to parse into more meaningful internal data structures. 2. In the final step when rendering text for the human to read, generated from internal data structures.

I think it would be interesting (though perhaps not practical) if arc had only two commands with string support (string-to-sexp fmt str) and (sexp-to-string fmt sexp)... In this case, the 'fmt parameter would be some kind of definition of the string syntax, something like a BNF or RegEx description. The only other things you'd be able to do is somehow acquire it from the user and somehow display it to the user. Any internal manipulation of strings would be impossible and unnecessary.

Once a string is parsed into an sexp, the sexp would contain only symbols and numbers. The symbols would be standard lower-case and contain no weird characters. All strings would need to be translated into such an sexp using the 'fmt description. There would be no string or character data types. (Clearly there would seem to be lots of apparent limitations if you completely excised strings from a language like this, but I wonder if they could be addressed if the right approach is taken)

-----

0 points by bitcirkel 6408 days ago | link

I strongly agree. After all, there are no particular accommodations for sounds, images, and what have you. Why would there be one for verbal data?

Strings have no place in the core logic of a program. It is only because of inertia that we have this remnant from the early terminal days.

And strings bring their own set of problems (not very useful for a 100-year language) like translation, ascii vs latest unicode version, coupling (the web is finally beginning to get this right by separating behaviour from content and presentation).

-----

1 point by absz 6408 days ago | link

In fact, many languages (or at least their large libraries) do have accommodations for sounds, images, etc. This is because most languages have some sort of "class" mechanism, and create classes for those things (in their standard library or in a very common one). And sometimes, what you are working on is a string parsing/manipulating/generating program, where strings do belong.

-----

5 points by drcode 6434 days ago | link | parent | on: Will/Can Arc create a LISP-revival?

Well, I don't think anyone can say arc has been getting any "buzz"...

Besides the early flurry of articles at its release it hasn't really gotten much notice. But that's OK- the goal of this language is to create something with a long time horizon in mind. Nobody, not even pg, would argue that arc, in its current form, is much of a technological breakthrough yet. Its contributions are more conceptual at this point. I think, though, for a certain style of programmer (such as myself and the few others frequenting this forum :-) it has a lot to offer, even in its current, incomplete, form.

If arc causes a Lisp revival, it would probably take a long time (a decade?) for that to happen. The chance that any new programming language will survive that long is small, so I think you'd have to be pretty sober about the odds involved. However, I have no doubt that arc will presage features in successful future languages, even if it, in itself, may have only a small chance of success.

-----


It looks like a dreaded "line noise" language ala perl :)

-----

3 points by jmatt 6438 days ago | link

I think there is a more pleasant way to view it by decompiling.The language looks like byte code to me.

From the manual http://www.basis.uklinux.net/ursala/manual.pdf

  $ fun --main="˜&nSiiDPSLrlXS" --decompile
  main = compose(
    map field((0,&),(&,0)),
    compose(
      reduce(cat,0),
      map compose(
        distribute,
        compose(field(&,&),map field(&,0)))))
EDIT: Reread the manual. It is a mangled perl like language. Seems useful if you are crunching equations and plotting.

-----

1 point by graindish 6438 days ago | link

The language is compiled to virtual machine code similar to what the listing shows, and is closer to the functional programming camp than to perl (ultra fp geeky features for defining your own fixed point combinators in section 7.5.3).

-----

2 points by sacado 6438 days ago | link

I found it was more looking like K or something close.

-----

2 points by bOR_ 6438 days ago | link

K++ perhaps. I'm sort of making unjust fun of the language, but I seriously prefer ((())()()) to this.

  #import std
  #import nat
  
  #comment -[
  solves the general case of the 8 queens problem;
  invoke as queens -n, where n is a number > 3]-
  
  #executable <'par',''>
  #optimize+
  
  queens =
  
  %np+~command.options.&h.keyword.&iNC; -+
     ~&iNC+ file$[contents: --<''>+ %nLP*=; * '<'%='[ '+          ','%=', '+ '>'%=' ]']+ ~&rSSs+ nleq-<&l*rFlhthPXPSPS,
   ~&i&& ~&lNrNCXX; ~&rr->rl %tLnLtXLLWXMk+ ^/~&l ~&lrrhrSiF4E?/~&rrlPlCrtPX ~&r; ^|/~& ^|T\~& -+
      -<&l^|*DlrTS/~& ~&iiDlSzyCK9hlPNNXXtCS,
      ^jrX/~& ~&rZK20lrpblPOlrEkPK13lhPK2; ~&i&& nleq$-&lh+-,
   ^/~&NNXS+iota -<&l+ ~&plll2llr2lrPrNCCCCNXS*=irSxPSp+   ^H/block iota; *iiK0 ^/~& sum+-

-----

2 points by drcode 6439 days ago | link | parent | on: Suggestion for two core features

on #2, I would prefer:

(5 x) ==> (is 5 x)

...and also:

('foo x) ==> (is 'foo x)

...assuming that doesn't cause a problem I don't see right now...

-----

2 points by nex3 6439 days ago | link

I don't like this because then you have inconsistent behavior between types. It feels like you're saying, "If you can find something useful to do on function call, do that... otherwise just run is." Why wouldn't

  ((table) (table))
work?

-----

2 points by sacado 6438 days ago | link

I don't like it. What does (tb x) mean ? Does it mean "look for the key 'x in table 'tb" (provided 'tb is a table) or "is variable 'x holding the same thing as variable 'tb" ?

However, I think this could be a good candidate for ssyntax :

  foo?x ==> (is foo x)

-----

2 points by cchooper 6438 days ago | link

Definitely like that idea. Using is is a real pain and I have to use it all the time.

-----

1 point by cchooper 6439 days ago | link

The problem I see with the second one is:

  ('foo) x) == ((quote foo) x)
so there would be no way of telling if you were trying to do a list-ref.

-----

More