GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: The Nu programming language.
Homepage: http://programming.nu
Clone URL: git://github.com/timburks/nu.git
Simplified atom? and string? operators, made (atom? nil) and (nil atom) 
consistent (both true).
timburks (author)
Tue Aug 05 12:13:29 -0700 2008
commit  f172d71ed38a341162542524b9a67e17fe5d7221
tree    3cb303c195f48cc955ef51f8ab12d865ea295be2
parent  b8ab31a90bd1459d9fcb7a8f4c72e62dcf18786e
...
37
38
39
40
41
42
43
44
 
45
46
47
...
64
65
66
67
 
68
69
70
...
91
92
93
94
95
96
 
 
 
97
98
99
100
101
102
103
104
105
106
107
108
 
 
 
 
 
 
109
110
111
...
113
114
115
116
117
118
119
120
121
122
123
124
125
 
 
 
 
 
 
 
 
 
 
126
127
128
...
134
135
136
137
 
138
139
140
141
 
 
142
143
144
...
154
155
156
157
 
158
159
160
161
162
 
163
164
165
...
183
184
185
186
 
187
188
189
...
37
38
39
 
 
 
 
 
40
41
42
43
...
60
61
62
 
63
64
65
66
...
87
88
89
 
 
 
90
91
92
93
94
95
96
97
98
 
 
 
 
 
 
99
100
101
102
103
104
105
106
107
...
109
110
111
 
 
 
 
 
 
 
 
 
 
112
113
114
115
116
117
118
119
120
121
122
123
124
...
130
131
132
 
133
134
135
 
 
136
137
138
139
140
...
150
151
152
 
153
154
155
156
157
 
158
159
160
161
...
179
180
181
 
182
183
184
185
0
@@ -37,11 +37,7 @@
0
 
0
 (global atom?
0
         (do (x)
0
- (or (null? x)
0
- (number? x)
0
- (symbol? x)
0
- (string? x)
0
- (char? x))))
0
+ (x atom)))
0
 
0
 (global number?
0
         (do (x)
0
@@ -64,7 +60,7 @@
0
 
0
 (global string?
0
         (do (x)
0
- (eq (x class) NSCFString)))
0
+ (eq (x class) ("" class))))
0
 
0
 (global symbol?
0
         (do (x)
0
@@ -91,21 +87,21 @@
0
 ;; For example (apply + '(1 2)) returns 3.
0
 (global apply
0
         (macro _
0
- (set __f (eval (car margs)))
0
- (set __args (eval (cdr margs)))
0
- (eval (cons __f __args))))
0
+ (set __f (eval (car margs)))
0
+ (set __args (eval (cdr margs)))
0
+ (eval (cons __f __args))))
0
 
0
 ;; Evaluates an expression and raises a NuAssertionFailure if the result is false.
0
 ;; For example (assert (eq 1 1)) does nothing but (assert (eq (+ 1 1) 1)) throws
0
 ;; an exception.
0
 (global assert
0
         (macro _
0
- (set expression (car margs))
0
- (if (not (eval expression))
0
- (then (throw ((NSException alloc)
0
- initWithName:"NuAssertionFailure"
0
- reason:(expression stringValue)
0
- userInfo:nil))))))
0
+ (set expression (car margs))
0
+ (if (not (eval expression))
0
+ (then (throw ((NSException alloc)
0
+ initWithName:"NuAssertionFailure"
0
+ reason:(expression stringValue)
0
+ userInfo:nil))))))
0
 
0
 ;; Allows mapping a function over multiple lists.
0
 ;; For example (map + '(1 2) '(3 4)) returns '(4 6).
0
@@ -113,16 +109,16 @@
0
 ;; For example (map + '(1 2) '(3)) returns '(4).
0
 (global map
0
         (progn
0
- (set _map
0
- (do (f _lists)
0
- (if (_lists select:(do (x) (not x)))
0
- (then '())
0
- (else
0
- (cons
0
- (apply f (_lists map: (do (ls) (first ls))))
0
- (_map f (_lists map: (do (ls) (rest ls)))))))))
0
- (do (fun *lists)
0
- (_map fun *lists))))
0
+ (set _map
0
+ (do (f _lists)
0
+ (if (_lists select:(do (x) (not x)))
0
+ (then '())
0
+ (else
0
+ (cons
0
+ (apply f (_lists map: (do (ls) (first ls))))
0
+ (_map f (_lists map: (do (ls) (rest ls)))))))))
0
+ (do (fun *lists)
0
+ (_map fun *lists))))
0
 
0
 ;; Sorts a list.
0
 (global sort
0
@@ -134,11 +130,11 @@
0
 
0
 ;; Throws an exception.
0
 ;; This function is more concise and easier to remember than throw.
0
-(global throw*
0
+(global throw*
0
         (do (type reason)
0
             (throw ((NSException alloc) initWithName:type
0
- reason:reason
0
- userInfo:nil))))
0
+ reason:reason
0
+ userInfo:nil))))
0
 
0
 ;; Returns an array of filenames matching a given pattern.
0
 ;; the pattern is a string that is converted into a regular expression.
0
@@ -154,12 +150,12 @@
0
                  ((results allObjects) sortedArrayUsingSelector:"compare:"))))
0
 
0
 (class NSMutableArray
0
-
0
+
0
      ;; Concisely add objects to arrays using this method, which is equivalent to a call to addObject:.
0
      (- (void) << (id) object is (self addObject:object)))
0
 
0
 (class NSMutableSet
0
-
0
+
0
      ;; Concisely add objects to sets using this method, which is equivalent to a call to addObject:.
0
      (- (void) << (id) object is (self addObject:object)))
0
 
0
@@ -183,7 +179,7 @@
0
              (set __signatureForIdentifier (NuBridgedFunction functionWithName:"signature_for_identifier" signature:"@@@"))
0
              (function __parse_signature (typeSpecifier)
0
                   (__signatureForIdentifier typeSpecifier (NuSymbolTable sharedSymbolTable)))
0
-
0
+
0
              (set __name ((margs car) stringValue))
0
              (unless (set __protocol (Protocol protocolNamed: __name))
0
                      (set __protocol ((Protocol alloc) initWithName: __name)))
...
34
35
36
37
 
38
39
40
...
34
35
36
 
37
38
39
40
0
@@ -34,7 +34,7 @@ extern id Nu__null;
0
 @implementation NSNull(Nu)
0
 - (bool) atom
0
 {
0
- return false;
0
+ return true;
0
 }
0
 
0
 - (int) length

Comments

    No one has commented yet.