This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctor = (C,...) -> | |
obj = setmetatable {}, C | |
init = rawget C, '_init' | |
if init | |
init(obj,...) | |
return obj | |
is_class = (C) -> | |
mt = getmetatable C | |
if mt and C._class -- this is a base class! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- | |
-- A list class that wraps a table | |
-- @classmod List | |
import insert,concat,remove from table | |
class List | |
--- constructor passed a table `t`, which can be `nil`. | |
new: (t) => | |
@ls = t or {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import parseopt | |
from strutils import parseInt | |
from os import existsFile | |
const usage = """ | |
head [flags] filename | |
-n: number of lines (default 10) | |
-h,--help: this help | |
-v,--version: version | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import strutils | |
from os import ParamCount, ParamStr | |
import tables | |
export tables.`[]` | |
#### Simple string lexer ### | |
type | |
PLexer = ref TLexer | |
TLexer = object | |
str: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tabsize=4 | |
indent.size=4 | |
use.tabs=0 | |
split.vertical=0 | |
open.dialog.in.file.directory=1 | |
statusbar.visible=1 | |
# treat Nimrod like Python | |
file.patterns.nim=*.nim | |
lexer.$(file.patterns.nim)=python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env lua | |
--[[ -- installing LDoc | |
function install() | |
-- requires('pl','Penlight') | |
-- install_script 'ldoc' | |
end | |
--]] | |
-- --[[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tablex' | |
local M = tonumber(arg[1]) or 10000 | |
local N = tonumber(arg[2]) or 1000 | |
local t_msg, t_start | |
function start_t (msg) | |
t_msg = msg | |
t_start = os.clock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local debug = require 'debug' | |
-- from.lua | |
-- supports some useful shortcuts when creating locals from tables or modules | |
-- require 'from' | |
-- local sin,cos,tan = slots(3) from(math) | |
-- local import,printf = slots(2) from 'pl.utils' | |
-- local pretty,utils,xml = slots(3) from 'pl.*' | |
-- | |
-- Uses the debug library, so it's not very fast - only use for top-level initialization! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include_directories("../src/") | |
add_library(xstr SHARED lily_xstr.c) | |
set_target_properties( | |
xstr | |
PROPERTIES | |
PREFIX "" | |
COMPILE_FLAGS "-fPIC -g" | |
) |