Arc Forumnew | comments | leaders | submit | brett's commentslogin

Thanks. My hope was to shadow whitepage to add styling to the login page with out messing with login-page.

I'm guessing this is related to the performance cost of expanding the macro on the fly?

-----

4 points by pg 6270 days ago | link

Right. Usually I'm happy to trade speed for increased flexibility, but expanding macros at runtime doesn't seem to let you do all that much more. If anything it seems conceptually cleaner to think of macros as being expanded away at the time a function is evaluated.

-----

2 points by brett 6270 days ago | link | parent | on: Arc date function error?

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

-----

1 point by mattjones 6270 days ago | link

Thanks. I looked manually for a post on this issue but didn't find it. It's easy enough for me to just fix my copy of the function for now.

-----

2 points by brett 6270 days ago | link | parent | on: Printing numbers as decimals?

Awesome. Thanks. I kept reading through arc.arc.

-----

2 points by brett 6271 days ago | link | parent | on: Editing Arc in TextMate...?

You can use selection for that in TextMate. If type ( with a block of text selected it wraps that block with parens.

-----

3 points by sjs 6271 days ago | link

That sort of works but still requires manual selection. Regardless there are many more reasons to work in Emacs when using lisp so I'll stick with it. (e.g. inferior-lisp-mode, send files or defs to a running lisp as you edit them)

-----

3 points by tel 6270 days ago | link

Textmate's lack of inferior process panes pretty much cripples it for most rapid iteration, REPL-esque programming in my mind.

-----

12 points by brett 6272 days ago | link | parent | on: How to modify a running web app?

start the server in a new thread

  (thread asv)

-----

5 points by tlrobinson 6272 days ago | link

Excellent, I didn't know threads were that easy, thank you.

-----

4 points by brett 6275 days ago | link | parent | on: Access to MzScheme functions

you could add

  (xdef 'log log)
to ac.scm

-----

1 point by bOR_ 6263 days ago | link

Thanks. Needed that for (xdef 'sin sin)

-----

8 points by brett 6275 days ago | link | parent | on: Possible Bug With Web Lib

It's not really a bug as much as an artifact of the REPL. You are seeing what the call to (link ...) prints and then the return value of the same call printed right after it by the REPL.

Changing the return value illustrates the point:

  arc> (no (link "A Link" "somepage.html"))
  <a href="somepage.html">A Link</a>nil
It might not be optimal that link (or really tag) always returns "</", but I'm not sure it matters.

-----

1 point by ryantmulligan 6275 days ago | link

This seems related to the previous confusion caused by prn's return value. http://www.arclanguage.org/item?id=302

Though the result of prn may be chosen for efficiency sake, doesn't feel consistent to me.

-----


you don't really need callcc as much as just storing proc closures

here's a ruby version a bit closer to the original. there's a bunch of support and then process roughly corresponds to said above

  #!/usr/bin/env ruby
  require 'rubygems'
  require 'mongrel'

  class FooHandler < Mongrel::HttpHandler
  
    def initialize
      @fnids = {}
      @c = 0
    end
  
    def new_fnid(proc)
      @c += 1
      @fnids[@c] = proc
      @c
    end
  
    def query_params(request)
      request.class.query_parse(request.params['QUERY_STRING'])
    end
  
    def pr(response, html)    
      response.start do |head,out|
        head["Content-Type"] = "text/html"
        out << html
      end
    end
  
    def w_link(response, link_text, &block)
      c = new_fnid(block)
      pr(response, "<a href='?fnid=#{c}'>#{link_text}</a>")
    end
  
    def aform(response, form_html, &block)
      c = new_fnid(block)
      pr(response, "<form><input type='hidden' name='fnid' value='#{c}'>#{form_html}</form>")
    end
  
    def process(request, response)
      if (fnid = query_params(request)['fnid'])
        @fnids[fnid.to_i].call(request, response)
      else
        aform(response, "<input name='foo'><input type='submit'>") do |req1, resp1|
          w_link(resp1, "click here") do |req2, resp2|
            pr(resp2, "you said: " + query_params(req1)['foo'])
          end
        end
      end
    end
  end

  Mongrel::Configurator.new :port => 8080 do
    listener {uri "/", :handler => FooHandler.new}
    trap("INT") {stop}
    run
  end.join

-----

3 points by s3graham 6275 days ago | link

Neat, thanks. (Not quite "right" since I can change &foo=myinput on page 2, but I'm guessing that could easily be fixed with an extra closure somewhere).

-----

3 points by brett 6276 days ago | link | parent | on: RSS Feed?

This just came up: http://www.arclanguage.org/item?id=273

http://www.arclanguage.org/rss

-----

3 points by brett 6276 days ago | link | parent | on: Page feed, where art thou?

Given that it's the same code as news.yc: http://www.arclanguage.org/rss

Looks to work.

-----

1 point by olifante 6276 days ago | link

Works for me too. Thanks!

-----