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
(defmacro a [person] | |
`(println "hello" ~person)) | |
user=> (macroexpand-1 '(a "mark")) | |
(clojure.core/println "hello" "mark") | |
user=> (a "mark") | |
hello mark | |
nil |
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
(defmacro a [person] | |
`(println "hello" ~person)) | |
user=> (macroexpand-1 '(a anybody)) | |
(clojure.core/println "hello" anybody) | |
user=> (a "anybody") | |
hello anybody | |
nil |
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
(defmacro a [person] | |
(list println "hello" person)) | |
(defmacro a [person] | |
'(println "hello" person)) |
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
(defn say-hello [person] println "hello" person) | |
(say-hello "Mark") | |
-> "Mark" | |
If I put the brackets in then it'll work fine: | |
(defn say-hello [person] (println "hello" person)) |
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
#light | |
open System | |
open System.IO | |
open System.Text.RegularExpressions | |
let (|File|Directory|) path = if(Directory.Exists path) then Directory(path) else File(path) | |
let getFileSystemEntries path = Directory.GetFileSystemEntries path |> Array.to_list | |
let files path = | |
let rec inner fileSystemEntries files = |
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
def parse | |
expr = assert_expr :expr | |
assert_done | |
expr | |
end | |
def assert_expr(name) | |
(e = send(name)) && (return e) | |
raise Sass::SyntaxError.new("Expected expression, was #{@lexer.done? ? 'end of text' : "#{@lexer.peek.type} token"}.") |
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 'sass/script/lexer' | |
module Sass | |
module Script | |
# The parser for SassScript. | |
# It parses a string of code into a tree of {Script::Node}s. | |
class Parser | |
# @param str [String, StringScanner] The source text to parse | |
# @param line [Fixnum] The line on which the SassScript appears. | |
# Used for error reporting |
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
let rec nums = seq { yield 1 | |
for n in nums do yield n+1 } | |
How does this work? | |
When we call 'nums' on line 2 it recurses to the function again which means that on the first recursion the only value | |
in 'nums' is 1? So then we add the value 2 into the sequence presumably. Which means that if we recurse again then 1 | |
and 2 will both be in the sequence. Not convinced I understand this very well... |
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
let rec nums = seq { yield 1 | |
printfn "yield 1" | |
for n in nums do | |
printfn "(for)yield %d" (n) | |
yield n+1 } | |
> Seq.take 5 nums |> Seq.iter (printfn "%d");; | |
1 | |
yield 1 | |
(for)yield 1 |
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
[Test] | |
public void ShouldNotCopyTheId() | |
{ | |
Mapper.Reset(); | |
Mapper.CreateMap<Mark, Mark>(); | |
Mapper.CreateMap<Foo, Foo>().ForMember(foo => foo.Id, opts => opts.Ignore()); | |
var mark = new Mark { Foos = new List<Foo> { new Foo { Id = Guid.NewGuid()}}}; | |
var newMark = Mapper.Map<Mark, Mark>(mark); |