Arc Forumnew | comments | leaders | submit | eds's commentslogin
1 point by eds 5873 days ago | link | parent | on: Getting Arc to run on Windows

You wouldn't have uname unless you installed cygwin and put it in PATH.

How are you running arc? I don't remember ever seeing this problem.

-----

1 point by thaddeus 5872 days ago | link

I see 'uname' exist in the file 'arc.sh' (anarki);

I am not sure what this file is for; it has no docs or info; looks like it sets a 'uname' to 'Darwin' for mac osx machines, then runs some scripts via mzscheme ?

Since I didn't have admin rights on the machine (work) I created a shortcut that launches mzscheme with the directory path and passed in a 'start in' directory to anarki.

I do believe we have cygwin installed for other purposes.

-----

1 point by kens 5872 days ago | link

It looks like you're using the anarki-specific bash script to start arc. The script executes uname (which returns the OS) and checks if it is 'Darwin'. You could probably change `uname` to 'junk' (note backquotes changed to single quotes) to disable this check. But if you're on Windows, running the bash script seems like asking for trouble.

-----

1 point by thaddeus 5872 days ago | link

Thanks, I will give it a go.

As a note: I am not using a bash script to launch arc, I'm using a basic windows shortcut. This arc.sh file is initiating on it's own (as from eds; maybe because cygwin? in path?)

T.

-----

1 point by thaddeus 5870 days ago | link

Changing uname to 'junk', didn't work (I even deleted the file) no luck (pg's arc2 doesn't have the uname problem, but errors on other things like creating directories and loading asv).

Anyone know how to prevent anarki from thinking my windows machine is unix machine?

Thanks, T

-----

1 point by thaddeus 5870 days ago | link

Nevermind - I figured it out. I just changed the lib.arc so that ffi.arc doesn't get loaded. I hope someone who knows how to use git can put ffi into the lib folder and not have it load by default. T.

-----


See http://arclanguage.org/item?id=8644. Specifically, it contains a link to http://arclanguage.com/item?id=3498, an example Apache config for Arc.

-----

2 points by eds 5900 days ago | link | parent | on: Everything is a function

If you haven't already seen it, you'd probably be interested in defcall on Anarki (http://github.com/nex3/arc/tree/master , search for "defcall" in arc.arc). I have used it, for example, in lib/infix.arc to define infix syntax on numbers, so that

  (3 + 4)
is equivalent to

  (+ 3 4)

-----

1 point by eds 5928 days ago | link | parent | on: A succinct method for sharing Arc libraries

There is a version of wget for Windows; you can get it from either Cygwin (http://www.cygwin.com/) or GnuWin32 (http://gnuwin32.sourceforge.net/). You can download the wget binary by itself at http://gnuwin32.sourceforge.net/packages/wget.htm .

I don't normally have any problems with forward/backward slashes on Windows (but I use Cygwin a lot, so my perspective may be biased).

-----

1 point by CatDancer 5928 days ago | link

So does the current version of lib work as it is with Cygwin and wget installed on Windows? Or is Cygwin even needed?

(I said that "Windows is not supported" but it would be more accurate to say that I haven't tried it with Windows).

-----


The CSS for news pages is in news.arc, starting around line 345 (search for news.css). You should be able to customize your page's look by editing this.

-----

2 points by eds 5963 days ago | link | parent | on: Two arithmetic ideas

(1) is available on Anarki via lib/infix.arc.

http://arclanguage.org/item?id=2610

One of the biggest problems is performance (about a 10x slowdown if you want to do infix analysis (i.e. order of operations) at runtime).

-----


Let me see if I understand your question.

  >    Arc > (eval (thad QYVSn5n1))
  >    ; this works... 
This works because you are evaluating the symbol QYVSn5n1 for it's value (whatever that happens to be).

Actually (if I understand your code correctly), you don't need the call to 'eval here, since everything put into the REPL already gets evaluated.

  >    Arc > (eval (thad ((temp-table 0) 1)))
  >    Error: "Function call on inappropriate object
This doesn't work because ((temp-table 0) 1) evaluates to the symbol QYVSn5n1, and then passes the symbol itself (not the value of the symbol) to 'thad. If 'thad expects something other than a symbol, this blows up.

If you want to get the value of symbol instead, try using 'eval on the symbol.

  arc> (= tab (table))
  #hash()
  arc> (= (tab 'foo) 'bar)
  bar
  arc> (= bar [prn "Hello, " _])
  #<procedure: bar>
  arc> (tab 'foo)
  bar
  arc> (eval (tab 'foo))
  #<procedure: bar>
  arc> ((eval (tab 'foo)) "world")
  Hello, world
  "Hello, "
Of course, if 'thad is really supposed to take a symbol rather than a table directly, you'll need to move the calls to eval inside 'thad.

(I'm curious: why do you need to use symbols here instead of just passing tables to 'thad?)

-----

1 point by thaddeus 5984 days ago | link

ah, I think I see how it can be done... I could bind the uniq-table-name to the symbol of the key. .... makes sense (I think) :).

I hadn't thought of this option because I had been storing the order number in the key position and wouldn't have been able to bind anything to a number like '0'. I was doing this because; calling the table using any table function that return all entries, does not return the order as it was stored, but rather it seems to return them randomly (and the order stored was not sortable). ex. (temp-table) or (vals temp-table).

I hope that made sense.

As for the other question(s),I'll try not to overwhelm....

I'm letting users upload one or many spreadsheets of their choice.... so I then store into a newly generated table which in turn generates html table(s) accessible using their web session. After they close out the web session there's no need to store the data since it will write it back out to a new spreadsheet an store it locally for them. Since I am re-using these functions, i've made them generic, but if they refresh the webpage the html-table functions needs to re-run passing in the correct table-names...so I keep track of which tables had been created for re-loading, hence the storing of the table names as symbols in a table.

I doubt that made sense, but it's what i could muster after 6 hours in front of this code :)

Thanks. T.

As a note my table contained more than just a pair, each entry in the temp-table was storing: order, value, type

-----

3 points by CatDancer 5984 days ago | link

calling the table using any table function that return all entries, does not return the order as it was stored, but rather it seems to return them randomly

Yes, if you need to keep track of things in a particular order (such as the order you added them), you should put them in a list.

Note that you can put the same data in both a list and in a table, if that is what you need for your application.

hence the storing of the table names as symbols in a table

If you want to have a mapping of table names to tables, you can store that in its own table:

  (= tables* (table))
  (= tables*!QYVSn5n1 my-data-table-1)
  (= tables*!UYg47nnb my-data-table-2)
then to get at a particular table

  (let table-name 'UYg47nnb
    (let data-table (tables* table-name)
      ... (vals data-table) etc. ...

-----

1 point by thaddeus 5984 days ago | link

Great! That worked for me.... Not sure why I didn't think of it, but hey I've only been programming for a month now :) Thanks for everyone's help. T.

    (= my-data-table-1 (table))
    (= (my-data-table-1 'drink) 'milk)
    (= (my-data-table-1 'eat) 'eggs)

    arc> (keys my-data-table-1)
    (drink eat)
    arc> (vals my-data-table-1)
    (milk eggs)

    (= my-data-table-2 (table))
    (= (my-data-table-2 'run) 'fast)
    (= (my-data-table-2 'walk) 'slow)

    arc>(keys my-data-table-2)
    (walk run)
    arc>(vals my-data-table-2)
    (slow fast)

    (= tables* (table))
    (= (tables* '0) my-data-table-1)
    (= (tables* '1) my-data-table-2)

    (def load-ordered-tables ()
      (for i 0 (- (len tables*) 1)
        (let current-table (tables* i)
          (pr (vals current-table))
     )
      ))
	

    arc> (load-ordered-tables)
    (milk eggs)(slow fast)nil

-----

1 point by CatDancer 5984 days ago | link

You're welcome!

If it turns out that you just need a list of your data tables, you can do this:

  (= tables* (list my-data-table-1 my-data-table-2))

  (def load-ordered-tables ()
    (each current-table tables*
      (pr (vals current-table))))

-----

1 point by thaddeus 5983 days ago | link

and ..Hey go figure..... I even figured out how to make it work the way I was originally attempting to make it work ! :)

    arc> temp-table
    #hash((0 . (0 hUv086uP)) (1 . (1 CH3w2sdp)))
    
    arc> ((temp-table 1) 1)
    CH3w2sdp

    (= CH3w2sdp (table))
    (= (CH3w2sdp 'run) 'fast)
    (= (CH3w2sdp 'walk) 'slow)

    (def thad ()
       (eval `(vals ,((temp-table 1) 1))))

     arc>(thad)
     (slow fast)
T.

-----

1 point by lboard 5956 days ago | link

Thanks

-----

1 point by thaddeus 5984 days ago | link

ugh - ok that didn't work after all.

The example:

    (= bar [prn "Hello, " _])
worked for you as it did not contain a table function requiring a table name passed in.

so I'm still stumpfied :) lol.

-----

1 point by cchooper 5984 days ago | link

@thaddeus

I'm not sure I understand what you're doing, but perhaps you need another table that maps the symbols you created to the tables they refer to. Call it table-names. Then you could rewrite thad like this:

  (def thad (table-or-table-name)
    (if (isa table-or-table-name 'table) (do-what-you-did-before)
        (thad (table-names table-or-table-name))))
But I suspect there is a better way of doing what you're trying to do, so if you give us some more details then we might be able to suggest a more sane alternative.

-----

2 points by eds 5988 days ago | link | parent | on: Ask Arc: does code have to be text?

I think you can already use images in PLT Scheme source code...

http://docs.plt-scheme.org/quick/

-----

1 point by shader 5948 days ago | link

Interesting. Code as data -> Data as Code. Pictures as data; pictures as code? That reminds me of some "graphical" programming language I saw a while ago. It used blocks of color to control the interpreter much like a Turing tape. The head would "move" up down, left or right depending on color, and perform various other operations.

How would you use images as code?

-----

1 point by cchooper 5988 days ago | link

That is very cool. I wonder if that works for input too.

-----

1 point by eds 5989 days ago | link | parent | on: Wiki list of websites & apps using Arc

Another one in the category of "things built by someone else":

http://ballerinc.com/ by antiismist (http://arclanguage.com/item?id=7564)

-----

1 point by antiismist 5980 days ago | link

that's sort of an aborted project for now.

-----

1 point by eds 5990 days ago | link | parent | on: Wiki list of websites & apps using Arc

Not pretty, but working:

http://elliottslaughter.net/star/rand

It's a random star system statistics generator for a tabletop pencil-and-paper sci-fi RPG (http://daemoneye.net/universaldecay.html). It can potentially save an experienced GM 30 minutes to an hour of work with every page view.

-----

More