Arc Forumnew | comments | leaders | submit | tiglionabbit's commentslogin
3 points by tiglionabbit 6003 days ago | link | parent | on: Poll: Destructive operations naming

The scheme way is also the ruby way, so it's probably the most conventional. I could see us using join/d though, as it looks kinda like the w/link method in the arc challenge, so we could be starting our own convention. Personally, I'd love to see a convention for predicates to end in '?', which would go along with the '!' convention quite well.

-----

4 points by bOR_ 6002 days ago | link

Except that the ruby way isn't consistent. ! is used to warn people that this method is destructive for sure. The lack of ! doesn't imply non-destructiveness.

That bit me before ;) http://www.ruby-forum.com/topic/135076#new

-----

2 points by almkglor 6002 days ago | link

The current Anarki ssyntaxes.arc defines foo? as [isa _ 'foo] :

  Arc2:
  (isa foo 'sym)

  Anarki w/ ssyntaxes.arc:
  (sym? foo)

-----

1 point by tiglionabbit 6071 days ago | link | parent | on: Hypothetical Web App: Image Gallery

>> We wouldn't want one user's file to upload over another, when we're still trying to shrink and process it. How do we avoid orphaning images if users re-upload things?

>Tough. Not sure what you exactly mean with this though.

This was actually part of the previous point, about temporary files. Many languages have tempfiles in their standard library. These help when you have a lot of users uploading things, and you want to make sure files don't clobber each other before you can decide where to put them. http://docs.python.org/lib/module-tempfile.html http://www.ruby-doc.org/core/classes/Tempfile.html

>> Should user icons be considered the same sort of thing as gallery images?

>Not sure what you mean by this either. What do you mean by "user icons"?

Most forums and art sites let their users upload a little picture, which is placed by each of their comments or posts. The difference between this and a normal image on the site is that, while other pictures may exist in different forms (e.g. full view / original, medium size, and thumbnail), user icons often only show up in one small standard size, and the original image they were shrunken from is not saved.

-----


EDIT: made it use sessions to answer the question properly

Here's a solution using the lovely simple web api Sinatra (http://sinatra.rubyforge.org/). How many tokens is this? I didn't use any form helpers, but I'm assuming string literals count as one token.

  require 'rubygems'
  require 'sinatra'

  get '/' do
    '<form action="success" method="POST"><input name="message"><input type="submit"></form>'
  end 

  post '/success' do
    session[:message] = params[:message]
    '<a href="show"> click here </a>'
  end

  get '/show' do
    "You Said: #{session[:message]}"
  end

-----

2 points by edw 6122 days ago | link

This solution blows--like many others--because it explicitly references a session. Additionally, explicitly referencing a form instead of implicitly providing form values to a procedure is pointless drudgery. Explicit session and state are like having to access all of your Python variables via globals['foo'] or locals['bar'].

The Arc Challenge isn't about Turing completeness: We know you can build a web app using an app server written in Conway's Game of Life, and while that's an interesting curiosity, it's not something that's pushing forward the state of the art. The challenge--for me, at least--is about thinking about how we can make the plumbing of a web application disappear, so we don't need to think about it any more.

-----

1 point by partdavid 6142 days ago | link

I'm not sure what session is, there.

-----

1 point by tiglionabbit 6141 days ago | link

Session is a base64-encoded cookie with a secret key for each sinatra app.

-----

2 points by tiglionabbit 6142 days ago | link | parent | on: How do I Run a Program?

>As for searching, the best way is probably to do a Google search for "my query site:arclanguage.org".

True, and I'd figured that out, but neglected to mention it because I still couldn't find what I wanted.

Anyways, search is an important feature these days that every site with some dynamic content should have. You can't expect google's indexer to keep up with all your changes, and a forum with any sort of scale should encourage its users to search for duplicate topics before starting their own lest redundancies abound. I'd like to see an arc solution for searching on these posts.

-----

1 point by almkglor 6141 days ago | link

Posts are stored in flat files in blog.arc (which I think is the basis for this site anyway)

Using my file-table: http://www.arclanguage.com/item?id=3762

You can then do: http://www.arclanguage.com/item?id=3822

Speed is an issue of course ^^. Possibly we could store, say, word counts for each post.

-----

2 points by tiglionabbit 6143 days ago | link | parent | on: How do I Run a Program?

What about on a mac? I was just told that this works: mzscheme -m -f as.scm < myprogram.arc

-----

3 points by sacado 6143 days ago | link

It does work, but don't do that :) At least if you're generating, for example, very big lists : everything evaluated in your program will be displayed. If your code contains something like (= foo (range 1 1000000)), you'll somewhat regret it...

But, in many cases, that will work just fine, despite the noise generated by the repl. You can also do mzscheme -m -f as.scm < myprogram.arc >/dev/null to turn the whole output off (in case you don't need it at all).

-----

2 points by absz 6143 days ago | link

Or wrap your whole program in a (do ... t) block, which is what I do. No change in semantics, and everything works fine.

-----

3 points by eds 6143 days ago | link

I believe the mzc compiler works on mac. (I'm not talking about exe's in the Windows sense here.)

Yes, that works, if you don't mind command-line hacks.

-----