on space_check(threshold_percentage)
tell application "Finder"
set the percent_free to ¬
(((the free space of the startup disk) / ¬
(the capacity of the startup disk)) * 100) div 1
end tell
if the percent_free is less than the threshold_percentage then
tell application (path to frontmost application as text)
display dialog "The startup disk has only " & the percent_free & ¬
" percent of its capacity available." & return & return & ¬
"Should this script continue?" with icon 1
end tell
end if
end space_check
what is this retarded language?
guess what, OP; to people who actually know real programming languages, this is less readable than what they normally work with.
i'll take: if(percent_free < threshold_percent)
over: if the percent_free is less than the threshold_percentage then
any day, faggot
Name:
Anonymous2009-02-27 18:18
i'll take:
if(percent_free < threshold_percent)
over:
if the percent_free is less than the threshold_percentage then
any day, faggot
Agreed. It is more concise and doesn't want to make me kill people.
Name:
Anonymous2009-02-27 18:21
Expressive abstractions are what really matters.
loeb :: Functor a => a (a x -> x) -> a x
loeb x = fmap (\a -> a (loeb x)) x
>>6
I've seen this before, and it's still a bit confusing. I know how it works with the list functor instance, but what about others, like IO, State, and such?
It looks almost comonadic. Is it a dual of some monadic function, perhaps?
P.S. It's funny how Haskell nomads manage to obscure every concept with so many abstract nonsense that they don't even know what it is anymore.
Name:
Anonymous2009-02-27 22:05
>>1
Another example of why natural languages are a bad idea to model a programming language after.
Name:
Anonymous2009-02-27 22:10
>>1
about half of that is just syntactic noise. "the" and so forth can be eliminated without changing anything. after that, it ends up looking a lot like visual basic.
though it's like going from a $2 bottle of really bad wine to a $5 bottle of bad wine.
... oh also, applescript does most definitely allow the normal operators such as + / < > <= etc. (even unicode ones like ≤ ≥ ≠)
people diss it because they think it's overly verbose and cobol-esque, but you can actually write "normal" looking code with it, and on top of that you can control a large portion of the os, including doing all sorts of complex interactions between different programs, with it. it's really quite flexible and powerful if used properly.
though it is still a $5 bottle of bad wine. but it'll get you drunk.
Name:
Anonymous2009-02-28 0:05
declare a variable of type integer called x that contains a value of 0 and has a local scope;
repeat the following single line of code until my integer variable called x contains an integer value equal to that of the integer literal value 100:
increment the value of my integer variable called x by an integer value of 1;
output to the user console a line of text that contains the following literal string value "the value of x is " and the integer variable value of my integer variable x and a line break;
>>15
Nice made-up non-example. Next time, use languages you know.
Name:
Anonymous2009-02-28 0:47
>>17
it was an example of how trying to treat programming languages as human languages just leads to incredible amounts of wasted typing.
i'm amazed you didn't understand something so simple and obvious - actually, what am i saying? you're a macfag, ofcourse you were too stupid to realise the point.
>>18
no, it was an example of giving fake evidence in support of a correct position, in an attempt to make people who hold the correct position look less credible.
yes, we see what you did there, macfag.
declare a variable of type integer called x that contains a value of 0 and has a local scope;
repeat the following single line of code until my integer variable called x contains an integer value equal to that of the integer literal value 100:
increment the value of my integer variable called x by an integer value of 1;
output to the user console a line of text that contains the following literal string value "the value of x is " and the integer variable value of my integer variable x and a line break;
vs
public class Loop {
public static void main(String[] args) {
Loop myLoop = LoopFactory.getInstance(0,100,Loop.ASCENDING);
while(myLoop.hasNext()) {
System.out.println(myLoop.getLoopPosition());
myLoop.incrementPosition();
}
}
public static final int ASCENDING = 1;
public static final int DESCENDING = -1;
private int min;
private int max;
private int direction;
private int current;
protected Loop() {}
public static Loop getNewLoop(int min, int max, int direction) {
Loop self = new Loop();
self.setLoopMin(min);
self.setLoopMax(max);
self.setLoopDirection(direction);
int startPos = direction==Loop.ASCENDING?min:max;
self.setLoopPosition(startPos);
}
public void setLoopMax(int max) {
this.max = max;
}
public void setLoopMin(int min) {
this.min = min;
}
public void setLoopPosition(int position) {
this.current = position;
}
public void setLoopDirection(int direction) {
this.direction = direction;
}
public int getLoopPosition() {
return this.current;
}
public boolean hasNext() {
if(direction==Loop.ASCENDING && Loop.current==max) return false;
if(direction==Loop.DESCENDING && Loop.current==min) return false;
return true;
}
public void incrementPosition() {
this.current+=this.direction;
}
public static class LoopFactory {
protected LoopFactory() {}
public Loop getInstance() {
return getInstance(0,0,1);
}
public Loop getInstance(int min, int max, int direction) {
return Loop().getNewLoop(min,max,direction);
}
}
}
it's a tough decision; i know
Name:
Anonymous2009-02-28 3:24
>>20
Why would you do that?
At least the top example is plausible
This is completely illogical
Name:
Anonymous2009-02-28 4:06
>>21
What is wrong with the Java implementation? Industry rules require at least one factory and singleton in any program at minimum; so this barely passes as usable.
Applescript is only one of the different interfaces to the real core, OSAScript. It is possible to access it through much cooler languages, such as JAVASCRIPT
Name:
Anonymous2009-02-28 8:49
>Loop myLoop = LoopFactory.getInstance(0,100,Loop.ASCENDING); public static final int ASCENDING = 1; public static final int DESCENDING = -1;
I cring'd
>User-friendliness is what really matters
That's why AppleScript is totally useless - it's too hard for a retard and too unreadable for a programmer.
>>29
Are you unaware of contextual meaning of characters?
Name:
Anonymous2009-02-28 10:46
>>31
Are you fond of italics, or just pleased to see me?
Name:
Anonymous2009-02-28 10:49
Hi, this post is all about ¬, REAL ¬. This post is awesome. My name is Robert and I can't stop thinking about ¬. These are cool; and by cool, I mean totally sweet.
Fact:
1. ¬ is an operation.
2. ¬'s negate all the time.
3. The purpose of ¬ is to flip out and 'not' things.
Name:
Anonymous2009-02-28 11:03
>>33 ¬'s negate all the time
¬'s negate all the time what?
Name:
Anonymous2009-02-28 11:05
>>34
HAY DUDE PERHAPS U SHOULD FAMILUARIZE URSELF WITH INTERNET CULTURE SO THAT YOU CAN UNDERSTAND AND APPRECIATE SUPER-WITTY PARODIES LIKE >>33
Name:
Anonymous2009-02-28 11:10
>>35
Sir, perhaps you should familiarize yourself with grammar.
You should see a doctor and get some medication before it spreads to the rest of /prog/
Name:
Anonymous2009-02-28 15:09
/prog/ delenda est
Name:
Anonymous2009-02-28 15:29
>>48
Nah, I'll control this. I'll just take a little break from /prog/.
I'm not responding after this post.
Name:
Anonymous2009-02-28 16:07
>>1
Actually, true user-friendliness would be Automator.app.
Unfortunately it doesn't seem to be as powerful as Applescript. I struggle to find a way to reproduce your script in it, maybe it's just my unfamiliarity with the IDE: http://img19.imageshack.us/img19/8319/picture1nhu.png