Partial evaluation means to fix some variables in the given code before execution. With a traditional implementation of a compiler or an interpreter, all variables are replaced with its value on each evaluation of that variable. This is because a variable can change at any timing. This is, however, not always true in actual applications. Almost all of large applications has setting variables and data
This file contains hidden or 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
| class LinkedList(T) | |
| include Enumerable | |
| class Node(T) | |
| property :next | |
| property :data | |
| def initialize(@data : T, @next = nil) | |
| end | |
| end |
This file contains hidden or 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 'rubygems' | |
| require 'mechanize' | |
| FIRST_NAME = 'FIRST_NAME' | |
| LAST_NAME = 'LAST_NAME' | |
| PHONE = 'PHONE' | |
| EMAIL = 'EMAIL@provider.com' | |
| PARTY_SIZE = 2 | |
| SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' } |
This file contains hidden or 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
| SetOutputFilter DEFLATE |
This file contains hidden or 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 "SDL.h" | |
| #include "SDL_image.h" | |
| #include "SDL_rotozoom.h" | |
| #ifdef EMSCRIPTEN | |
| #include "emscripten.h" | |
| #endif | |
| SDL_Surface *screen; | |
| SDL_Surface *sprite[4]; |
This file contains hidden or 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
| /* | |
| * Minimal C++ implementation of Functor, Monad and Maybe. | |
| * | |
| * Requires c++0x variadic templates and lambda expressions: | |
| * | |
| * g++ -std=c++0x main.cpp -o main | |
| * | |
| * fmap, monadic bind and return implementations for std::vector | |
| * and Maybe. | |
| * |
Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).
This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.
If you want to use or share this material, please see the license file, below.
This file contains hidden or 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
| #!/bin/bash | |
| # MacRuby | |
| rm -rf /Library/Frameworks/MacRuby.framework | |
| XCODE_DIR=`xcode-select -print-path` | |
| # tool | |
| rm -f "$XCODE_DIR"/usr/bin/rb_nibtool | |
| rm -f "$XCODE_DIR"/Tools/rb_nibtool |
This file contains hidden or 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
| # | |
| # MIT License - (c) 2011 John Mettraux | |
| # | |
| require 'rubygems' | |
| require 'parslet' # gem install parslet | |
| module MyJson |
This file contains hidden or 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 <clang-c/Index.h> | |
| #include <cstdlib> | |
| #include <iostream> | |
| /* | |
| * Compile with: | |
| * g++ complete.cc -o complete -lclang -L/usr/lib/llvm | |
| * Run with: | |
| * LIBCLANG_TIMING=1 ./complete file.cc line column [clang args...] | |
| */ |