Yeah, I didn't try to suppress error messages because I'm curious how often it actually finds something.
When you say blank, do you mean completely blank, or just no stories? Because caching means that stories take a minute to show up to nonlogged-in users.
Ok now it's not my environment. I have made no changes just the arc3 files and mzscheme372.
* I have only 3 posts and 3 comments, if I log in as admin and keep hitting the comments link - not crazily like, but right after the page load completes - about the 10th time or so the hyperlinks change format then the whole forum get locked and goes blank.
I am using mac osx.
After about an hour I'm getting the impression the forum is glitchy. There's just a bunch of quirky behavior like the above (pages are slower to load - page painting is noticeable.... etc etc)
Interesting though - I do find it odd that when applying defopl to the root "||" the function doesn't return to the root after login, but rather it fowards to an 'afterward' of "y". Looks as though the code expects that you pass a string in as the afterward and will not take || as an argument.
Ok I've been working at finally deploying something; I am running into problems.
Here's what I have done:
* I've set up a vps with linode; ubuntu 9.04 with apache2
* I've made sure my domain name hits the right IP.
(i.e. I get "It's Alive.") when I go to the domain name site.
* I've created a user on the VPS and deployed arc.
* I can launch arc and run the as the user.
(I notice (asv 80) doesn't work: "error 32"; I am gathering this is because I am not running as root - that's fine.).
* So I enable mod_proxy and added a proxypass to the apache httpd.conf file:
ServerName mydomain.com
ProxyPass / http://localhost:8080/
Restarted the apache server and I get the following at mydomain:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Ok so after getting an arc3 forum, running on linode - using proxypass I notice I am getting periodic 502 proxy errors.
Also I found this old post that claims that these timeouts are a side effect of the 'date' problem that Anarki had fixed, but in Arc3 pg fixed the date function so i am guessing this wouldn't be the issue?
I am proxy passing from port80 to 3 different ports for 3 different domains (each running it's own arc server). Looks like the calls are getting mixed up.
ie. mydomain1.com, mydomain2.com, mydomain3.com
looks like mydomain1.com should be calling
mydomain1.com/public/favicon.ico
but instead it's getting passed to mydomain2.com
File does not exist: ....mydomain2.com/public/favicon.ico
hmmm. There must be a better way to keep the pointers in order. Back to google :)
I'm hazarding guess, but I think when apache can't find a file via the arc servers static directory apache attempts to find it using anyone if not all of the public directories listed in the virtual hosts.
strange, but anyway - thanks for trying to help Cat, sorry to be a pain - this was my first time installing apache, linux or doing any of this stuff :).
Nice. Thanks.
I think that's Russian correct? (pardon if I got it wrong).
I'm just curious. Although I don't use hacker news much (can't relate to the topics as much) - I can see how the layout and usage is much better than most sites I visit. And I can see a mutlitude of uses for it - not just news. So I am just surprised I haven't seen more of them. I was thinking about starting one up for my industry peers (not the hackers).
Just wanted to see what other members experiences were.
T.
Works for me. I am reading onlisp while I learn arc, and although I don't fully understand half the code in the book the concepts are what's important.
As an example; I think it's like chapter 25 where pg describes how one can do object oriented programming in lisp. I was able to look at his code a see how his functions became fewer more readable lines in arc, but more over I am able to start working on oo concepts even though arc doesn't have a direct map to class and superclass functions.
The really good idea would be to rewrite all the code from the book in Arc. I love the book and I don't know Common Lisp. The book would be much clearer with examples written in Arc. For example generalized variables: I didn't even read examples from the book, I read the Arc source instead.
I imagine a table as I would like to perform all the normal table operations on it like:
(keys mything*)
or (mything* 'this)
etc etc...
I initially thought a function like (point mything* (parent* thing*)) would be ideal, but then realized it would also probably require the 'let' usage to work otherwise the scope would be a problem.
Could you either describe what you want to accomplish or else give some working code examples that you'd like to see simplified? I'm having trouble figuring out what you want your code to do from these fragments.
-> So table thing* is a key in the table parent*?
Yes.
Ok so this is probably exposing how newbish I really am, but please bear with me.... I tried to create an example that better describes what I am thinking.
I was thinking it would be nice to set up all my pointers at the beginning, then the last few lines of code ,where the meat is, become less cluttered with syntax and more about what, from a conceptual perspective, I am doing:
So you'll notice a few things; in function 1 - the last line requires having the full syntax for getting the roof budget; otherwise even though it's been re-set to 200; the let statement prior had already been set to 1996.0; so it forces me to re-use the syntax again; where ares the pointer notion in function 2 would not.....
Anyways - just the way my mind thinks (like a big spreadsheet haha). :)
write a function consisting of the parts that are the same, and make the parts that are different into variables:
(def (price area type subarea)
(((app* area) type) subarea))
(def area-situation (area sub-area)
(let area-budget (price area 'budget* sub-area)
(let area-forecast (price area 'forecast* sub-area)
(let delta (- area-forecast area-budget)
I would continue iteratively with this process of turning similar expressions into functions, but it looks like you may have a bug in your code? You store a new budget but print out the old one. Unless that's what you wanted?
There are a couple of advantages to this process of noticing expressions in your code that are similar and turning them into functions. First, you don't have to figure everything out in advance. You write some code and get it to work right. Then you look for similar expressions and turn them into functions. In practice this works a lot better than trying to figure out what functions you're going to need ahead of time.
The second advantage is that it makes your code easier to change. For example, suppose you wanted to change your representation of your prices from tables inside of tables into lists, or perhaps one table with a compound key. If you have lots of places where you say (((app* area) type) subarea)) then you'd need to change all of those, but if you have a few functions like price then you only need to change those.
The code didn't have the bug the results I gave did (too much copying and pasting) :)
the first function actually returns 200.
(forecast 1996.0 budget 200)
what I had intended to convey was that I had believed I was required to use the full syntax (((app* area) 'budget*) sub-area) in order to get the 200, which I did, but I wanted to just use 'area-budget' to make it more readable.
But as I learned there were so many things I was doing wrong it wasn't funny ... even though I am laughing now. bewahahahah ! :)
You can use 'with to create variables pointing just to the two tables you need and then there's less digging to do when you need to look up or alter values.
You might get better mileage by changing the data structure though if that's possible:
app*
yardwork ...
house
roof
budget = 1996.0
forecast = 1996.0
windows
budget = 1000.0
forecast = 1800.0
Arc doesn't really have "pointers" (at least not in the c/c++ sense) - you either have global variables, or local (lexically-scoped) variables. So you can create a local variable pointing to the innermost table using 'let or 'with. Oh, I said "pointing" - well, they're kinda pointers.
Does that point you in the right direction, or did I miss the point entirely?
btw with the hot new special-syntax you can write app.area.sub-area instead of ((app area) sub-area) - see http://arclanguage.org/item?id=9220
Accepting the hypothetical that there's not a clear-cut way to simplify the data structures (hey, it happens), I can't think of much to do. I know what it is you want to do, as the problem does crop up from time to time -- trying to make use of the expression instead of the value of an expression. An obvious way to solve this would be to introduce a macro, e.g.
But this isn't a very palatable solution -- you'd need to define macros for each field, and even then they're only shortcuts, really. It'd be easier if there were a shorter way to do nested indexing (which there will be, come arc3: http://arclanguage.org/item?id=9163).
Upon writing this and finding someone else replying, I notice that conanite's post http://arclanguage.org/item?id=9326 contains probably the best solutions, though.
I like the mac idea too. if the concepts like "budget" and "forecast" are the main data concepts of the program; then I can see being able to re-use the macro a lot. Also I have to read up on 'deftem' and 'inst'.
Initially I tried to make operator/variable names descriptive, but as time went on I became tired of typing every descriptive name again and again so, obviously, I tried to establish a balance between readability and convenience... However, the more I code the more I notice the names become shorter and find it takes effort to achieve meaningful names. That balance is going to be different person to person, but I will hazard a guess that the more you code the shorter the names become.
as an example (not that the function works):
(def fill (table-name with)
(filltable table-name with))
(def fillcup (with size)
(let cup size
(fill cup with)))
(fillcup "coffee" 8oz*)
The above is ideally how I would name names, but then find myself trying to incorporate the data type into the name...
(def fillcup (with-string size-table)
(let cup size-table
(fill cup with-string)))
which I think is equally as bad as:
(def fillcup (s tb)
(let cup tb
(fill cup s)))
This last one is bad as 'tb' may tell it's a table, but what is it conceptually? A size table...
So here are my options:
* the idealized version isn't descriptive enough
* if all my code were fully descriptive I would be
worse off reading and typing everything.
* the short form is just as bad as both the idealized
version and the descriptive version.
So it doesn't surprise me that people go with the short form, the lesser of evils - perhaps ?
The worst part is that because all the options suck
I end up doing things like:
(def fillcup (with-str size-tb)
(let cup size-tb
(fill cup with-str)))
Which by then I hate my code and should have just stuck with the idealized or the short.
I personally wish there were a means to quickly identify the data-type without having to incorporate it into the name, something like a hover tag - this would, more often, allow myself to afford the meaningful without being overly descriptive.
(I currently use textmate to write code and the terminal for the repl).
Just and opinion from a hobby programmer with only a few hundred hours programming experience.
"The sticking point is compression-tolerance. As you write code through your career, especially if it's code spanning very different languages and problem domains, your tolerance for code compression increases. It's no different from the progression from reading children's books with giant text to increasingly complex novels with smaller text and bigger words."
If my understanding is vaguely correct, Yegge argues for compact code for the same reasons pg does.
I personally wish there were a means to quickly identify the data-type
Something that an editor for a dynamic language can give you is run-time analysis of your code - so, indeed, a mouse-over could in fact give you a list of the types assigned to any given symbol. This is something I'd love to get welder to do ... it's entirely possible, in theory :)
Alternatively, you could write your own function definition macro that lets you specify param types and checks them for you at runtime:
I enjoyed the first half - then he went on and on and on....
My goal is to try making code readable enough that documentation or 'metadata' is barely needed. I'm going to rework my code and start keeping my code idealized - not descriptive - not short.
I'm going see how it works when I drop the data type tagging all together and hope one day when I am a little more knowledgeable I will be able to craft a solution.
Maybe in a few years I'll let you know how it went :)
T