Sha256: 314ce907a420eee46f8a46561a90cd7904e0f73d5a0b0494da99b364f0b3f0f6
Contents?: true
Size: 957 Bytes
Versions: 2
Compression:
Stored size: 957 Bytes
Contents
module Lasp CORELIB = { :+ => -> (_, *args) { args.reduce(:+) }, :- => -> (_, *args) { args.reduce(:-) }, :* => -> (_, *args) { args.reduce(:*) }, :/ => -> (_, *args) { args.reduce(:/) }, :< => -> (_, *args) { args.sort == args }, :> => -> (_, *args) { args.sort.reverse == args }, :"=" => -> (_, *args) { args.uniq.count == 1 }, :list => -> (_, *args) { args }, :head => -> (_, list) { list.first }, :tail => -> (_, list) { list.drop(1) }, :cons => -> (_, item, list) { [item] + list }, :not => -> (_, arg) { !arg }, :println => -> (_, output) { puts output }, :"." => -> (_, obj, meth) { obj.send(meth) } } end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lasp-0.1.1 | lib/lasp/corelib.rb |
lasp-0.1.0 | lib/lasp/corelib.rb |