- 浏览: 1040639 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
Lori_Liu:
但是这样还是不合适,我的代码是这样写的...<appli ...
MapView不渲染变成空白和灰色网格了? -
56553655:
这个格式是好的:http://blog.csdn.net/fe ...
非常详细GC学习笔记 -
wangfulong:
刚刚有测试了一下 返回的结果集一样 但是exists执行的时间 ...
SQL养成一个好习惯是一笔财富 -
wangfulong:
比如NOT EXISTS:
SELECT TITLE FRO ...
SQL养成一个好习惯是一笔财富 -
yuzihan607:
第一题是79年李政道去访问中科大,给当时少年班提出的一个问题, ...
最新腾讯,创新工场,淘宝等公司最新面试十三题(更新至24题)
今天(五月三日)下午,与@qichangxing,@phaytsukiming,@heyFluke,@linluxiang,@vonbo,@qingliangcn,@benky52 等约13人在广州红专厂艺术区的黑胶咖啡馆聚会。大家可以通过 #GZTechParty 这个 tag 在 twitter 上看这个过程。
我做了个小演讲,跟大家介绍了一下 Falcon 这一门小众的编程语言,以下是分享的 PPT。
发表发现 csdn blog 还是不能显示 swf,请大家跳转到 这里 查看幻灯。
以下是大纲
====================================
- Falcon 初印象 赖勇浩 2010.5.3
- 特性
- 开源
- 简单
- 快速
- 强大
- 我最讨厌
python 的 GIL
- Falcon 完全支持多线程编程
- 每条线程都运行在一个单独的 VM 上
- 我最讨厌 python 不支持协程
- 不完全支持
- Falcon 支持
- 大家都讨厌 python 的速度
- Falcon 要快得多
- Raw VM loop speed:1023
-
- Python:442|340
-
- Lua:1247
- Raw VM loop speed
-
- int a = 0;
-
- for( int i = 0; i < 100000000; i++ ) a = a + 1;
- 第一行代码
- number = 0
- 数 = 0
- stdout
- printl
- >>
- >
- if/elif/else 语句
- if expression
-
- statements...
- elif expression
-
- statements...
- elif expression
-
- statements...
- /* other elifs */
- else
-
- statements...
- end
- 逻辑操作符
- and
- or
- not
- not 优先级最高
- 三
元表达式
- <condition> ? <if true> [ : <if false>]
- switch
语句
- switch expression
-
- case item [, item, .. item ]
-
-
- statements...
-
-
- case item [, item, .. item ]
-
-
- statements...
-
-
- /* other cases */
-
- default
-
-
- statements...
-
- end
-
- print( "Enter your age: >" )
- age = int( input() )
- switch age
-
- case 1 to 5
-
-
- printl( "You are too young to program. Maybe." )
-
-
- case 6, 7, 8
-
-
- printl( "You may already be a great Falcon programmer." )
-
-
- case 9, 10
-
-
- printl( "You are ready to become a programmer." )
-
-
- default
-
-
- printl( "What are you waiting for? Start programming NOW" )
-
- end
-
- switch month
-
- case nil
-
-
- > "Undefined"
-
-
- case "Jan", "Feb", "Mar"(P43)
-
-
- > "Winter"
-
-
- case "Apr", "May", "Jun"
-
-
- > "Spring"
-
-
- case "Jul", "Aug", "Sep"
-
-
- > "Summer"
-
-
- default
-
-
- > "Autumn"
-
- end
- 甚
至是……
- switch func
-
- case print
-
-
- printl( "It was a print !!!" )
-
-
- case printl
-
-
- printl( "It was a printl !!!" )
-
-
- case MyObject
-
-
- printl( "The value of func is the same of MyObject" )
-
- end
- select 语句
- select variable
-
- case TypeSpec
-
-
- ...statements...
-
-
- case TypeSpec1 , TypeSpec2 , ..., TypeSpecN
-
-
- ...statements...
-
-
- default
-
-
- ...statements...
-
- end
-
- select param
-
- case IntegerType, NumericType
-
-
- return "number"
-
-
- case StringType: return "string"
-
- case Test2: return "class test2"
-
- case Test: return "class test"
-
- case Instance: return "instance obj"
-
- default : return "something else"
- end
- while
语句
- while expression
-
- statements...
-
- [break]
-
- statements...
-
- [continue]
-
- statements...
- end
- loop
语句
- count = 0
- loop
-
- > ++ count
- end count == 100
- 哦,跟 do...while 语句一样……
- for/in 循环
- 嗯……其实很多语言都有……它的只是 太强大了……
- for variable[,variable...] in collection
-
- ...statements...
-
- [break | continue | continue dropping]
-
- ...statements...
-
- forfirst
-
-
- ... first time only statements ...
-
-
- end
-
- formiddle
-
-
- ... statements executed between element processing ...
-
-
- end
-
- forlast
-
-
- ... last time only statements ...
-
-
- end
- end
- continue dropping
- array = [ 1, 2, 3, 4, 5 ]
- for elem in array
-
- if elem % 2 == 1
-
-
- continue dropping
-
-
- end
-
- printl( "We accepted the even number: ", elem )
- end
- dot-assign
- for elem in array
-
- .= 0 // sets all the array elements to zero...
-
- printl(elem) // ... but prints the original items
- end
- For/in
ranges
- for value in [1:10]
-
- printl( value )
- end
- for value in [ 0: 11: 2 ]
-
- > value
- end
- For/to loops
- for variable = lowerbound to upperbound [, step]
-
- // for/to body, same as for/in
- end
- for i = 1 to 10
-
- forfirst: >> "Starting: "
-
- >> i
-
- formiddle: >> ", "
-
- forlast: > "."
- end
- for i = 2 to 10, 2
-
- > i
- end
- const
- const name = immediate_value
- enum
- enum Seasons
-
- spring
-
- summer
-
- autumn
-
- winter
- end
- > Seasons.spring // 0
-
- enum Seasons
-
- spring = 1 // 1
-
- summer // 2
-
- midsummer = "So hot..." // "So hot..."
-
- endsummer // 3 (string skipped)
-
- autumn = 10.12 // 10.12
-
- winter // 11
- end
- 基本数据类型
- Array
- String
- Dictionary
- List
- Array
- array = ["person", 1, 3.5, int( "123" ), var1 ]
- array = "person", 1, 3.5, int( "123" ), var1
- a2 = .[ 1 2 3 4 'a' 'b' var1 + var2 var3 * var4 .[x y z]]
- a, b, c = 1, 2, 3
- array = 1, 2, 3
- a, b, c = array
- range
- R=[n : m] means "all items from n to m-1"
- String
- string = "Hello world"
- longString = "
-
- Aye, matey, this is a very long string.
-
- Let me tell you about my remembering
-
- of when men were men, women were women,
-
- and life was so great.“
- iStr = '
-
- 国 際ストリング
-
- 国際ストリング
-
- ‘
- > 'Hello ''quoted'' world!' // Will print "Hello 'quoted' world"
- 基础特性跟 C 字符串相似
- String
replication
- sep = "-~*~-" * 12
- > sep
- > " "*25 + "Hello there!"
- > sep
- String-to-number
concatenation
- string = "Value: " + 100
- > string // prints "Value: 100"
- string = "Value: " % 64
- > string // prints "Value: A"
- string %= 0x3B2
- > string // "Value: Aβ"
- d_letter = "a" / 3 // chr( ord('a') + 3) == 'd'
- a_letter = d_letter / -3 // chr( ord('d') - 3) == 'a'
- > a_letter, ", ", d_letter
- String
expansion operator
- value = 1000
- printl( @ "Value is $value" )
- array = [ 100, 200, 300 ]
- printl( @ "Array is $array[0], $array[1], $array[2]" )
- printl( @ "The selected value is $(array[ value ])." )
- dict = [ "a" => 1, "b" => 2]
- > @ "A is $(dict['a']), and B is $(dict["b"])"
- Dictionary
- dict = [ => ] // creates an empty dictionary
- dict = [ "a" => 123, "b" => "onetwothree" ]
- printl( dict["a"] ,":", dict["b"] ) // 123:onetwothree
- a = [ 1=>'1', 2=>'2', "alpha"=>0, "beta"=>1 ]
- List
- deque
- 高 效的两端操作
- l = List( "a", "b", "c" )
- > "Elements in list: ", l.len()
- > "First element: ", l.front()
- > "Last element: ", l.back()
- l.pushFront( "newFront" )
- > "New first element: ", l.front()
- l.push( "newBack" )
- > "New first element: ", l.back()
- l.popFront()
- l.pop()
- > "Element count now: ", l.len()
- in/notin
- name = input()
- if "abba" in name
-
- printl( "Your name contains a famous pop group name" )
- end
- dict = [ "one" => 1 ]
- if "one" in dict
-
- printl( "always true" )
- end
- if "abba" notin name
-
- printl( "Your name does not contain a famous pop group name" )
- end
- Memory buffers
- memory = MemBuf( 5, 2 ) // creates a table of 5 elements, each 2 bytes long.
- for value in [0:5]
-
- memory[ value ] = value * 256
- end
- Bitwise operators
- &&
- ||
- ^^
- ~
- <<
- >>
- &= |= ^=
- <<= >>=
-
- value = 0x1 || 0x2 // or bits 0 and 1
- // display binary:
- > @"$(value:b)b = $(value:X)H = $value"
- value = value && 0x1 // turns off bit 2
- > @"$(value:b)b = $(value:X)H = $value"
- value = ~value && 0xFFFF // Shows first 2 bytes of reversed value
- > @"$(value:b)b = $(value:X)H = $value"
- value = value ^^ 0x3 // turns off bit 2 and on bit 1
- > @"$(value:b)b = $(value:X)H = $value"
- 函
数
- function do_something( parameter )
-
- printl( "Hey, this is a function saying: ", parameter )
- end
- return nil
-
- function square( x )
-
- y = x * x
-
- return y
- end
- 递归
- function sum_of_first( x )
-
- if x > 1
-
-
- return x + sum_of_first( x - 1 )
-
-
- end
-
- return x
- end
- Local and global
variable names
- sqr = 1.41
- function square( x )
-
- printl( "sqr was: ", sqr )
-
- sqr = x * x
-
- return sqr
- end
- number = square( 8 ) * sqr
- function square_in_z( x )
-
- global z
-
- z = x * x
- end
- z = 0
- square_in_z( 8 )
- printl( z ) // 64
-
- function say_something()
-
- static
-
-
- data = [ "have", "a", "nice", "day" ]
-
-
-
- current = 0
-
-
- end
-
- if current == len( data )
-
-
- return
-
-
- end
-
- element = data[current]
-
- current += 1
-
- return element
- end
- Anonymous and nested functions
- innerfunc
- var = innerfunc ( [param1, param2, ..., paramN] )
-
- [static block]
-
- [statements]
- end
- square = innerfunc ( a )
-
- return a * a
- end
- printl( "Square of 10: ", square( 10 ) )
- Function
closure
- function keyword
- function makeMultiplier( operand )
-
- multiplier = function( value )
-
-
- return value * operand
-
-
- end
-
- return multiplier
- end
- m2 = makeMultiplier( 2 ) // ... by 2
- > m2( 100 ) // will be 200
- m4 = makeMultiplier( 4 ) // ... by 4
- > m4( 100 ) // will be 400
- Codeblocks
- 匿名函数的语法糖
- lambda 表达式
- block = { [p1, p2..., pn] => expression }
- // or
- block = { [p1, p2..., pn] =>
-
- statement
-
- ...
- }
- printl( {a, b => a + b}(2,2) )
- Callable arrays
- array 的第一个元素是函数,即为 callable array
- printl( "Hello world" )
- [printl]( "Hello world" )
- [printl, "Hello"]( " world" )
- [printl, "Hello", " ", "world"]()
- i = 0
- icall = .[printl $i ": "]
- for i in [0:10]: icall( "Looping..." )
- Accessing
the calling context
- fself keyword
- caller keyword
- function recurse( val )
-
- if val <= 0: return 1
-
- > recurse.caller(), ":", val // or fself.caller()
-
- return recurse( val-1 ) + val
- end
- recurse( 5 )
- Non positional parameters
- function f( alpha, beta, gamma )
-
- > @"alpha: $alpha"
-
- > @"beta : $beta"
-
- > @"gamma: $gamma"
- end
- f( gamma| "a" + "b" + "c", beta|"b-value" )
-
- future bindings
- future_beta = beta|"b-value"
- future_gamma = lbind( "gamma", "a" + "b" + "c" )
- f( future_gamma, future_beta )
- The lbind function can create late and future bindings;
- f( non_existing|"value" ) // raises an error!
- object
- object object_name [ from class1, class2 ... classN]
-
- property_1 = expression
-
- property_2 = expression
-
- ...
-
- property_N = expression
-
- [init block]
-
- function method_1( [parameter_list] )
-
-
- [method_body]
-
-
- end
-
- ...
-
- function method_N( [parameter_list] )
-
-
- [method_body]
-
-
- end
- end
- object 就是单件模式?
- class
- class class_name[ ( param_list ) ] [ from inh1[, inh2, ..., inhN] ]
-
- [ static block ]
-
- [ properties declaration ]
-
- [init block]
-
- [method list]
- end
-
- class mailbox( max_msg )
-
- capacity = max_msg * 10
-
- name = nil
-
- messages = []
-
- init
-
-
- printl( "Box now ready for ", self.capacity, " messages." )
-
-
- end
-
- function slot_left()
-
-
- return self.max_msg - len( self.messages )
-
-
- end
- end
- Property accessors
- __set_propname/__get_propname
- class Series( values )
-
- values = values
-
- function __get_mean()
-
-
- sum = 0
-
-
-
- for i in self.values: sum += i
-
-
-
- return sum / self.values.len()
-
-
- end
- end
- s = Series( [14,53,18,8] )
- > "The mean is: ", s.mean // 23.25
-
- class parent1( p )
- end
- class parent2( p )
- end
- class child(p1, p2) from parent1( p1 ), parent2( p2 )
-
- init
-
-
- > "Initializing child with ", p1, " and ", p2
-
-
- end
- end
- instance = child( "First", "Second" )
- Private members
- _
- object privateer
-
- _private = 0
-
- function getPrivate(): return self._private
-
- function setPrivate(value): self._private = value
- end
- Operator
overloading
- class OverPlus( initValue )
-
- numval = initValue
-
- function add__( operand )
-
-
- return OverPlus( self.numval + operand )
-
-
- end
- end
- op = OverPlus( 10 )
- nop = op + 10
- > nop.numval //: 20
- Comparison overloading
- Comparison operators, namely <, >, <=, >=, == and != all refer to the same overloaded method: compare.
- 没有 __ 结尾
- class CmpOver( val )
-
- number = val
-
- function compare( oper )
-
-
- if oper provides number
-
-
-
-
- return self.number - oper.number
-
-
-
-
- elif oper.typeId() == NumericType or oper.typeId() == IntegerType
-
-
-
-
- return self.number - oper
-
-
-
-
- end
-
-
-
- return nil
-
-
- end
- end
- ten = CmpOver( 10 )
- > "Is ten > 5? ", ten > 5
- > "Is ten != 3? ", ten != 3
- > "Is ten <= 10? ", ten <= 10
- > "Is ten > an array? ", ten > [1,2,3]
- Subscript
overloading
- []
- getIndex__
- setIndex__
- Automatic string conversion
- toString method
- Error
recovery
- try
-
- [try statements]
-
- [ catch [object_type] [ in error_variable] ]
-
- [ catch statements ]
- end
- raise keyword
- Thank you!
- @laiyonghao
- http://laiyonghao.com
相关推荐
"Falcon"是一个与字体设计相关的主题,这通常指的是一个特定的字体家族或者一款设计风格独特的字体。在IT领域,字体是人机交互中至关重要的元素,它不仅影响着信息的可读性,还对用户界面的美观度和用户体验有着直接...
【FALCON】是一款著名的字体,它在设计和排版领域具有广泛的用途。这款字体以其独特的风格和可读性著称,通常用于标题、广告设计、标志制作等,为视觉传达带来强烈的冲击力和艺术感。 在IT行业中,字体扮演着至关...
Open Falcon企业级监控系统是一款广泛应用于国内大中型企业与互联网公司的开源监控解决方案,它能够帮助企业实时监控基础设施的性能,及时发现并处理系统故障,确保业务的稳定运行。v0.3.0是该系统的其中一个版本,...
### Open-Falcon 教程详解 #### 一、Open-Falcon 概述 Open-Falcon 是一款由小米公司开发并开源的监控系统,主要用于服务监控和运维管理。它旨在解决传统监控工具如 Zabbix 在大规模互联网环境下的局限性,如性能...
**Falcon Python Web框架** Falcon是一个高性能、轻量级的Python Web框架,设计用于构建API服务和微服务。它的核心特性是速度和效率,使其成为处理大量并发请求的理想选择。"支持异步"这一点尤为突出,意味着Falcon...
在STK官方模型库中,有一款名为"Falcon 10"的模型,这并非随软件安装自带的模型,而是由社区成员分享的丰富资源。本文将深入探讨这款模型的特点、使用方法以及其在STK中的应用。 "Falcon 10"模型是专为STK设计的一...
**Open-Falcon安装详解** Open-Falcon是一款开源的分布式监控系统,专为大规模集群环境设计,提供实时性能数据采集、处理、报警等功能。在本文中,我们将详细介绍如何在64位CentOS 6.4操作系统上安装并配置Open-...
OpenFalcon是一款由小米公司开发并开源的企业级监控系统,其设计目标是提供高可用性和可扩展性,以满足大规模分布式系统的监控需求。这个压缩包文件"**falcon-plus.zip**"包含了OpenFalcon的源代码,特别是"**falcon...
Apache Hadoop---Falcon Apache Falcon 是一个专为Hadoop生态系统设计的开源数据生命周期管理框架。它的主要目标是简化大数据处理中的数据流管理和自动化数据管理任务。在Hortonworks的Hadoop发行版HDP...
【小米监控工具open-falcon安装包】 open-falcon是一款由小米公司开源的、适用于大规模分布式系统监控的平台,它能够实时收集、传输、存储和展示各类运维数据,为企业的IT基础设施提供全面的健康检查和性能监控。...
"Falcon"通常指的是“猎鹰”,在IT领域中,它可能是指华为的FusionInsight Falcon,这是一个针对大数据场景的高性能、高可用的资源调度系统。在这个上下文中,"falcon-windows-agent"很可能是FusionInsight Falcon...
falcon 辅助设计软件
"非安装文件自带的"说明了这些模型并非随STK软件安装时提供的默认模型,而是由用户或社区成员额外创建和分享的。这通常意味着模型可能包含更详尽或定制化的特性,以满足特殊分析或演示需求。 压缩包内的"falcon20_...
【标题】"Falcon用于全文历史搜索的Chrome扩展"是一个基于JavaScript开发的浏览器插件,专为提升Chrome浏览器的历史搜索体验。它利用先进的全文搜索技术,使得用户在浏览历史记录时能够快速、精确地找到所需的网页。...
Ruby-Falcon是一个专门为Ruby语言设计的高性能Web服务器,它的出现为开发者提供了在处理高并发、低延迟场景下的优秀选择。Falcon的主要特点是其对HTTP/2协议和HTTPS的支持,这使得它在现代Web服务中具备了高效且安全...
Python Falcon是大数据交互式可视化分析的一个强大框架,它专为高效处理海量数据而设计,能够实现无延迟的交叉过滤功能,让数据分析师可以快速洞察百万条记录中的模式和趋势。这个框架利用Python的强大功能和易用性...
在标题中提到的 "apache-atlas-2.1.0-falcon-hook.tar.gz" 是 Apache Atlas 的一个特定版本,即 2.1.0 版本,包含了与 Apache Falcon 集成的钩子(hook)组件。这个压缩包是在 CDH 6.3.1(Cloudera Data Hub)平台上...
《falcon.zip:高效本体对齐工具的深度解析》 在当今大数据时代,知识图谱作为结构化信息的重要载体,被广泛应用于搜索引擎、智能问答、推荐系统等多个领域。为了提高知识图谱的质量和互操作性,本体对齐成为了一个...
Go-Falcon是一个基于Go语言开发的开源企业级监控系统,其设计目标是为企业提供全面、实时、高效的数据监控服务。Falcon系统集成了多种监控功能,包括但不限于性能指标收集、告警策略设置、数据可视化以及丰富的插件...
《深入理解Open-Falcon:网络监控系统的构建与应用》 Open-Falcon是一款开源的、企业级的分布式监控系统,广泛应用于大型互联网企业和云计算平台,为用户提供全面的网络监控解决方案。本篇文章将深入探讨Open-...