-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
lasso.scroll
341 lines (295 loc) · 13.8 KB
/
lasso.scroll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
import ../code/conceptPage.scroll
id lasso
name Lasso
appeared 1995
creators Kyle Jessup
tags pl
website http://www.lassosoft.com
blog http://www.lassosoft.com/Lasso-News
isOpenSource false
fileExtensions lasso LassoApp
fileType text
documentation https://docs.lassox.com/
rosettaCode http://www.rosettacode.org/wiki/Category:Lasso
centralPackageRepositoryCount 0
country Canada
originCommunity LassoSoft Inc
helloWorldCollection Lasso
// Hello world in Lasso
Hello world!
pygmentsHighlighter Lasso
filename javascript.py
fileExtensions lasso lasso[89]
lineCommentToken //
multiLineCommentTokens /* */
booleanTokens true false
hasComments true
hasLineComments true
// A comment
hasMultiLineComments true
/* A comment
*/
hasSemanticIndentation false
hasBooleans true
wikipedia https://en.wikipedia.org/wiki/Lasso_(programming_language)
example
// Define type
define bottles_of_beer => type {
// Define internal data
data private bottles = 99
// Define private methods
private br => '<br/>'
private s => .bottles != 1 ? 's' | ''
// Generate lyrics when object represented as a string
public asstring => {
local(out = '')
// Use Lasso query syntax to generate the lyrics
with n in 99 to 1 by -1 do {
.bottles = #n
#out += .bottles + ' bottle' + .s + ' of beer on the wall, ' + .br
#out += .bottles + ' bottle' + .s + ' of beer; ' + .br
.bottles--
#out += 'Take one down, pass it around, ' + .br
#out += .bottles + ' bottle' + .s + ' of beer on the wall. ' + (.br * 2)
}
// Return result
return #out
}
}
bottles_of_beer
related c linux dylan smalltalk scala html php python java sql unicode utf-8 cfml applescript mysql eclipse-editor asp
summary Lasso is an application server and server management interface used to develop internet applications and is a general-purpose, high-level programming language. Originally a web datasource connection tool, for Filemaker and later included in Apple Computer's FileMaker 4.0 and Claris Homepage as CDML, it has since evolved into a complex language used to develop and serve large-scale internet applications and web pages. Lasso includes a simple template system allowing code to control generation of HTML and other content types. Lasso is object-oriented and every value is an object. It also supports procedural programming through unbound methods. The language uses traits and multiple dispatch extensively. Lasso has a dynamic type system, where objects can be loaded and augmented at runtime, automatic memory management, a comprehensive standard library, and three compiling methodologies: dynamic (comparable to PHP-Python), just-in-time compilation (comparable to Java or .NET Framework), and pre-compiled (comparable to C). Lasso also supports Query Expressions, allowing elements within arrays and other types of sequences to be iterated, filtered, and manipulated using a natural language syntax similar to SQL. Lasso includes full Unicode character support in the standard string object, allowing it to serve and support multi-byte characters such as Japanese and Swedish, and supports transparent UTF-8 conversion when writing string data to the network or file system. Lasso is often used as a scripting language, and also used in a wide range of non-scripting contexts. Lasso code can be packaged into standalone executable programs called "LassoApps", in which folder structures are compiled into single files. The Lasso Server application server runs as a system service and receives requests from the web server through FastCGI. It then hands the request off to the appropriate Lasso Instance, which formulates the response. Multiple individual instances are supported, allowing one server to handle multiple sites, each as separate processes. The server uses a high performance IO-based green threading system designed for multi-core systems. Lasso can be compared to the server-side scripting languages PHP and Python, ColdFusion, Ruby, etc. Free for development, Lasso allows partial access to its source code, allowing developers to add or change major components of the language (for example, Ke Carlton's DS implementation of the Lasso Inline). Licensing comes in both SAS and stand-alone versions.
pageId 524247
dailyPageViews 35
created 2004
backlinksCount 35
revisionCount 429
appeared 1995
fileExtensions lasso LassoApp
tiobe Lasso
domainName lassosoft.com
registered 2005
awisRank
2022 12026019
githubBigQuery Lasso
repos 435
users 388
linguistGrammarRepo https://github.com/bfad/Sublime-Lasso
firstCommit 2013
lastCommit 2014
committerCount 1
commitCount 11
sampleCount 4
example
/**
trait_json_serialize
Objects with this trait will be assumed to convert to json data
when its ->asString method is called
*/
define trait_json_serialize => trait {
require asString()
}
define json_serialize(e::bytes)::string => ('"' + (string(#e)->Replace(`\`, `\\`) & Replace('\"', '\\"') & Replace('\r', '\\r') & Replace('\n', '\\n') & Replace('\t', '\\t') & Replace('\f', '\\f') & Replace('\b', '\\b') &) + '"')
define json_serialize(e::string)::string => ('"' + (string(#e)->Replace(`\`, `\\`) & Replace('\"', '\\"') & Replace('\r', '\\r') & Replace('\n', '\\n') & Replace('\t', '\\t') & Replace('\f', '\\f') & Replace('\b', '\\b') &) + '"')
define json_serialize(e::json_literal)::string => (#e->asstring)
define json_serialize(e::integer)::string => (#e->asstring)
define json_serialize(e::decimal)::string => (#e->asstring)
define json_serialize(e::boolean)::string => (#e->asstring)
define json_serialize(e::null)::string => ('null')
define json_serialize(e::date)::string => ('"' + #e->format(#e->gmt ? '%QT%TZ' | '%Q%T') + '"')
/*
define json_serialize(e::array)::string => {
local(output) = '';
local(delimit) = '';
#e->foreach => { #output += #delimit + json_serialize(#1); #delimit = ', '; }
return('[' + #output + ']');
}
define json_serialize(e::staticarray)::string => {
local(output) = '';
local(delimit) = '';
#e->foreach => { #output += #delimit + json_serialize(#1); #delimit = ', '; }
return('[' + #output + ']');
}
*/
define json_serialize(e::trait_forEach)::string => {
local(output) = '';
local(delimit) = '';
#e->foreach => { #output += #delimit + json_serialize(#1); #delimit = ', '; }
return('[' + #output + ']');
}
define json_serialize(e::map)::string => {
local(output = with pr in #e->eachPair
select json_serialize(#pr->first->asString) + ': ' + json_serialize(#pr->second))
return '{' + #output->join(',') + '}'
}
define json_serialize(e::json_object)::string => {
local(output) = '';
local(delimit) = '';
#e->foreachpair => { #output += #delimit + #1->first + ': ' + json_serialize(#1->second); #delimit = ', '; }
return('{' + #output + '}');
}
define json_serialize(e::trait_json_serialize) => #e->asString
define json_serialize(e::any)::string => json_serialize('<LassoNativeType>' + #e->serialize + '</LassoNativeType>')
// Bil Corry fixes for decoding json
define json_consume_string(ibytes::bytes) => {
local(obytes) = bytes;
local(temp) = 0;
while((#temp := #ibytes->export8bits) != 34);
#obytes->import8bits(#temp);
(#temp == 92) ? #obytes->import8bits(#ibytes->export8bits); // Escape \
/while;
local(output = string(#obytes)->unescape)
//Replace('\\"', '\"') & Replace('\\r', '\r') & Replace('\\n', '\n') & Replace('\\t', '\t') & Replace('\\f', '\f') & Replace('\\b', '\b') &;
if(#output->BeginsWith('<LassoNativeType>') && #output->EndsWith('</LassoNativeType>'));
Protect;
return serialization_reader(xml(#output - '<LassoNativeType>' - '</LassoNativeType>'))->read
/Protect;
else( (#output->size == 16 or #output->size == 15) and regexp(`\d{8}T\d{6}Z?`, '', #output)->matches)
return date(#output, -Format=#output->size == 16?`yyyyMMdd'T'HHmmssZ`|`yyyyMMdd'T'HHmmss`)
/if
return #output
}
// Bil Corry fix + Ke fix
define json_consume_token(ibytes::bytes, temp::integer) => {
local(obytes = bytes->import8bits(#temp) &,
delimit = array(9, 10, 13, 32, 44, 58, 93, 125)) // \t\r\n ,:]}
while(#delimit !>> (#temp := #ibytes->export8bits))
#obytes->import8bits(#temp)
/while
#temp == 125? // }
#ibytes->marker -= 1
//============================================================================
// Is also end of token if end of array[]
#temp == 93? // ]
#ibytes->marker -= 1
//............................................................................
local(output = string(#obytes))
#output == 'true'?
return true
#output == 'false'?
return false
#output == 'null'?
return null
string_IsNumeric(#output)?
return (#output >> '.')? decimal(#output) | integer(#output)
return #output
}
// Bil Corry fix
define json_consume_array(ibytes::bytes)::array => {
Local(output) = array;
local(delimit) = array( 9, 10, 13, 32, 44); // \t\r\n ,
local(temp) = 0;
While((#temp := #ibytes->export8bits) != 93); // ]
If(#delimit >> #temp);
// Discard whitespace
Else(#temp == 34); // "
#output->insert(json_consume_string(#ibytes));
Else(#temp == 91); // [
#output->insert(json_consume_array(#ibytes));
Else(#temp == 123); // {
#output->insert(json_consume_object(#ibytes));
Else;
#output->insert(json_consume_token(#ibytes, #temp));
(#temp == 93) ? Loop_Abort;
/If;
/While;
Return(#output);
}
// Bil Corry fix
define json_consume_object(ibytes::bytes)::map => {
Local('output' = map,
'delimit' = array( 9, 10, 13, 32, 44), // \t\r\n ,
'temp' = 0,
'key' = null,
'val' = null);
While((#temp := #ibytes->export8bits) != 125); // }
If(#delimit >> #temp);
// Discard whitespace
Else((#key !== null) && (#temp == 34)); // "
#output->insert(#key = json_consume_string(#ibytes));
#key = null;
Else((#key !== null) && (#temp == 91)); // [
#output->insert(#key = json_consume_array(#ibytes));
#key = null;
Else((#key !== null) && (#temp == 123)); // {
#output->insert(#key = json_consume_object(#ibytes));
#key = null;
Else((#key !== null));
#output->insert(#key = json_consume_token(#ibytes, #temp));
#key = null;
Else;
#key = json_consume_string(#ibytes);
while(#delimit >> (#temp := #ibytes->export8bits));
/while;
#temp != 58 ? Loop_Abort;
/If;
/While;
If((#output >> '__jsonclass__') && (#output->Find('__jsonclass__')->isa('array')) && (#output->Find('__jsonclass__')->size >= 2) && (#output->Find('__jsonclass__')->First == 'deserialize'));
Return(#output->find('__jsonclass__')->Second->First);
Else((#output >> 'native') && (#output >> 'comment') && (#output->find('comment') == 'http://www.lassosoft.com/json'));
Return(#output->find('native'));
/If;
Return(#output);
}
// Bil Corry fix + Ke fix
define json_deserialize(ibytes::bytes)::any => {
#ibytes->removeLeading(bom_utf8);
//============================================================================
// Reset marker on provided bytes
#ibytes->marker = 0
//............................................................................
Local(temp) = #ibytes->export8bits;
If(#temp == 91); // [
Return(json_consume_array(#ibytes));
Else(#temp == 123); // {
Return(json_consume_object(#ibytes));
else(#temp == 34) // "
return json_consume_string(#ibytes)
/If;
}
define json_deserialize(s::string) => json_deserialize(bytes(#s))
/**! json_literal - This is a subclass of String used for JSON encoding.
A json_literal works exactly like a string, but will be inserted directly
rather than being encoded into JSON. This allows JavaScript elements
like functions to be inserted into JSON objects. This is most useful
when the JSON object will be used within a JavaScript on the local page.
[Map: 'fn'=Literal('function(){ ...})] => {'fn': function(){ ...}}
**/
define json_literal => type {
parent string
}
/**! json_object - This is a subclass of Map used for JSON encoding.
An object works exactly like a map, but when it is encoded into JSON all
of the keys will be inserted literally. This makes it easy to create a
JavaScript object without extraneous quote marks.
Object('name'='value') => {name: "value"}
**/
define json_object => type {
parent map
public onCreate(...) => ..onCreate(:#rest or (:))
}
define json_rpccall(method::string, params=map, id='', host='') => {
#id == '' ? #host = Lasso_UniqueID;
#host == '' ? #host = 'http://localhost/lassoapps.8/rpc/rpc.lasso';
Return(Decode_JSON(Include_URL(#host, -PostParams=Encode_JSON(Map('method' = #method, 'params' = #params, 'id' = #id)))));
}
isbndb 0
githubLanguage Lasso
fileExtensions lasso las lasso8 lasso9
trendingProjects
author name avatar url language languageColor stars forks currentPeriodStars description
plotly dash-sample-apps https://github.com/plotly.png https://github.com/plotly/dash-sample-apps Lasso #999999 172 186 65 "Apps hosted in the Dash Gallery"
trendingProjectsCount 2
type programming
aceMode text
tmScope file.lasso
aliases lassoscript
repos 464
indeedJobs lasso engineer
2022 142
semanticScholar 4
year|title|doi|citations|influentialCitations|authors|paperId
2012|The Lasso Problem and Uniqueness|10.1214/13-EJS815|433|61|R. Tibshirani|e6676264d3af3604ee25f931aae78448b924fcf2
2013|Efficient block-coordinate descent algorithms for the Group Lasso|10.1007/s12532-013-0051-x|177|15|Zhiwei Qin and K. Scheinberg and D. Goldfarb|07ec2f2a0bd383d4bc86c7292a98c1de6b8b75ee
2013|A Dynamic Programming Algorithm for the Fused Lasso and L 0-Segmentation|10.1080/10618600.2012.681238|89|10|N. A. Johnson|0b49d72cc98f30f2cded046d98ebeae7789fc8ef
2016|Algorithms for Fitting the Constrained Lasso|10.1080/10618600.2018.1473777|81|10|Brian R. Gaines and Juhyun Kim and Hua Zhou|8331af696e9f758928ed1b962d9efa160284b8ec