Skip to content

Instantly share code, notes, and snippets.

View ab5tract's full-sized avatar

ab5tract ab5tract

  • Amsterdam, Netherlands
View GitHub Profile
commit d96dccd1737ed4ab7e5cf293a178f7d28aa1e1f1
Author: ab5tract <john.haltiwanger@gmail.com>
Date: Sat Aug 29 11:41:11 2015 +0200
Coercion from Set.list (via Any) is bonkers
diff --git a/src/core/Setty.pm b/src/core/Setty.pm
index e86b44d..4e491e0 100644
--- a/src/core/Setty.pm
+++ b/src/core/Setty.pm
begin
$: << 'lib'; %w( rubygems rake/testtask rake/rdoctask rake/gempackagetask extensions/all
utilities/string utilities/symbol date).each { |dep| require dep }
rescue LoadError => e
if e.message == 'no such file to load -- extensions/all'
puts "Better do `rake setup` to get all the fancies you're missing"
puts
else
raise e
end
# I was hoping something like this might work ....
# The hope was that config.database could as easily be a string as a hash....
+++configurations/development.rb
module Blog
module Configurations
class Development < Default
<ab5tract> we are trying to figure out the best/preferred way to interface with sequel
<ab5tract> so if thats what you recommend, we'l write a converter function that takes the hash and turns it into a URI
<jeremyevans> ab5tract: That function is already there. Database#uri
<ab5tract> well, thats handy :)
* wishdev (n=jwh@67.170.158.202) has joined #sequel
<ab5tract> jeremyevans, does Database#uri take a hash?
<ab5tract> its sort of a stupid question, but im not getting the kind of uri i would expect by doing:
<ab5tract> irb(main):007:0> q = Sequel::Database.new :adapter => 'jdbc', :database_type => 'postgresql', :host => 'localhost', :database => 'jblog', :user => 'waves'
<ab5tract> => #<Sequel::Database: "://waves@localhost/jblog">
<ab5tract> irb(main):009:0> q.uri
//////////////////////////
// Pattern Store
/////////////////////////
// parameters declaration
const PATTERNs = 8;
const STEPs = 32;
const IOs = 4;
var MEMs : integer;
//-----------------------------------------------------------------------------
// includes
//-----------------------------------------------------------------------------
#include "IndexOfChangedArray.h"
#include <vector>
//----------------------------------------------------------------------------
// create, general info and destroy methodes
//----------------------------------------------------------------------------
diff --git a/src/core/set_operators.pm b/src/core/set_operators.pm
index 841851f..7f72e91 100644
--- a/src/core/set_operators.pm
+++ b/src/core/set_operators.pm
@@ -108,16 +108,35 @@ only sub infix:<<"\x2216">>(|p) {
infix:<(-)>(|p);
}
-proto sub infix:<(^)>($, $ --> Setty) {*}
-multi sub infix:<(^)>(Any $a, Any $b --> Setty) {
@ab5tract
ab5tract / gist:5b65a86e7a1926079187
Created October 28, 2014 17:32
experiments in lookup inlining - perl 6
> (@words Z 1 xx @words.elems).hash
"does" => 1, "go" => 1, "how" => 1, "it" => 1
> $message.split(' ')
it go
> (@words Z 1 xx @words.elems).hash
"does" => 1, "go" => 1, "how" => 1, "it" => 1
> (@words Z 1 xx @words.elems).hash<$_> for @words
> (@words Z 1 xx @words.elems).hash<$_> for $message.split(' ')
> say (@words Z 1 xx @words.elems).hash<$_> for $message.split(' ')
(Any)
@ab5tract
ab5tract / leaning on MMD
Last active August 29, 2015 14:08
Two possible approaches to coercion in set comparisons
multi sub infix:<<(<)>>(Bag $a, Bag $b --> Bool) {
[&&] $a.keys.map({ $a{$_} < $b{$_} });
}
multi sub infix:<<(<)>>(Bag $a, Any $b --> Bool) {
$b = $b.bag(:view);
[&&] $a.keys.map({ $a{$_} < $b{$_} });
}
multi sub infix:<<(<)>>(Any $a, Bag $b --> Bool) {
@ab5tract
ab5tract / adventorator
Last active August 29, 2015 14:09
Adventures in Perl 6 Document Publishing
# The Plural of Advent is Adventerati
use v6;
#use XML;
#use XML::Parser::Tiny;
use HTML::Parser::XML;
use HTTP::UserAgent;