data Suit = Spade | Heart | Club | Diamond deriving (Eq, Ord, Enum, Show)
data Pip = Ace | Two | Three | Four | Five | Six | Seven | Eight | Nine | Ten | Jack | Queen | King deriving (Eq, Ord, Enum, Show)
data Card = Card
{suit :: Suit
,pip :: Pip
} deriving (Eq,Ord, Show)
type Deck = [Card]
data EOBoard = EOBoard
{foundations :: [Deck]
,columns :: [Deck]
,reserve :: [Deck]
} …Run Code Online (Sandbox Code Playgroud) data Nat = Zero | Succ Nat
type Predicate = (Nat -> Bool)
-- forAllNat p = (p n) for every finite defined n :: Nat
implies :: Bool -> Bool -> Bool
implies p q = (not p) || q
basecase :: Predicate -> Bool
basecase p = p Zero
jump :: Predicate -> Predicate
jump p n = implies (p n) (p (Succ n))
indstep :: Predicate -> Bool
indstep p = forallnat (jump p)
Run Code Online (Sandbox Code Playgroud)
题:
证明如果basecase …
我在终端中命令将数据库中的列更改为非空,但它似乎不起作用。
rails g migration change_column_null :Speaker, :surname, false
Run Code Online (Sandbox Code Playgroud)
我得到了一个文件 ChangeColumnNull 但在里面,它什么都不是。
class ChangeColumnNull < ActiveRecord::Migration
def change
end
end
Run Code Online (Sandbox Code Playgroud)
讲师(Def Create):
class CplecturesController < ApplicationController
layout 'cp_layout'
def create
@lecture = Lecture.new(lecture_params)
@lecture.save
redirect_to @lecture
end
private
def lecture_params
params.require(:lecture).permit(:lecture_title, :lecture_day, :column, :start_time, :end_time, :registered_speakers, :guest_speakers, :description)
end
end
Run Code Online (Sandbox Code Playgroud)
形式
<%= form_for :lecture, url:lectures_path do |f| %>
<form>
<div class="form-group">
<%=label_tag "Lecture Title" %><br>
<%= f.text_field :lecture_title, :class => "form-control", :placeholder => "Example: Why is Wordpress the best?" %>
</div>
Run Code Online (Sandbox Code Playgroud)