zemax微透镜阵列示例_阵列反向! Ruby中的示例方法

zemax微透镜阵列示例

阵列反向! 方法 (Array reverse! Method)

In this article, we will study about Array.reverse! method. You all must be thinking the method must be doing something related to reversing certain elements as we have done in the case of Array.reverse! method. It is not as simple as it looks. Well, we will figure this out in the rest of our content. We will try to understand it with the help of syntax and demonstrating program codes.

在本文中,我们将研究Array.reverse! 方法 。 大家都必须认为该方法必须像在Array.reverse情况下所做的那样与反转某些元素有关! 方法。 它并不像看起来那么简单。 好吧,我们将在其余内容中解决这个问题。 我们将尝试借助语法并演示程序代码来理解它。

Method description:

方法说明:

This method is a public instance method and defined for the Array class in Ruby's library. This method works in a way that reverses the content or objects present inside the Array instances. It traverses the Array elements in the way that the last element is considered to be first and the first object is considered to be the last element of the object of Array instance. Array.reverse is a destructive method where the changes created by this method would impact the actual order of the Self Array instance and these changes are permanent.

该方法是一个公共实例方法,为Ruby库中的Array类定义。 此方法的工作方式是反转Array实例中存在的内容或对象。 它以以下方式遍历Array元素:将最后一个元素视为第一个元素,将第一个对象视为Array实例对象的最后一个元素。 Array.reverse是一种破坏性方法,其中此方法创建的更改将影响Self Array实例的实际顺序,并且这些更改是永久的。

Syntax:

句法:

    Array_instance.reverse! -> new_array

Argument(s) required:

所需参数:

This method does not require any argument. Reversing the Array instance does not require anything rather than the Array instance itself.

此方法不需要任何参数。 反转Array实例不需要什么,只需要Array实例本身即可。

Example 1:

范例1:

=begin
Ruby program to demonstrate reverse! method
=end
# array declaration
Lang = ["C++","Java","Python","Html","Javascript","php","Ruby","Kotlin"]
puts "Array reverse! implementation."
print Lang.reverse!
puts ""
puts "The first element of the Array is: #{Lang[0]}"
puts "Array elements are:"
print Lang

Output

输出量

Array reverse! implementation.
["Kotlin", "Ruby", "php", "Javascript", "Html", "Python", "Java", "C++"]
The first element of the Array is: Kotlin
Array elements are:
["Kotlin", "Ruby", "php", "Javascript", "Html", "Python", "Java", "C++"]

Explanation:

说明:

In the above code, you can observe that we are reversing the contents of Array class instance with the help of Array.reverse! method. You can observe that after reversing the contents, the first element is "Kotlin" because this method is a destructive method and creates changes in the actual arrangements of contents in Array instance.

在上面的代码中,您可以观察到借助Array.reverse ,我们正在反转Array类实例的内容 方法 。 您可以观察到,在反转内容之后,第一个元素是“ Kotlin”,因为此方法是一种破坏性方法,会在Array实例中实际更改内容的排列方式。

Example 2:

范例2:

=begin
Ruby program to demonstrate reverse! method
=end
# array declaration
Table = [2,4,6,8,10,12,14,16,18,20]
puts "Array reverse! implementation"
print Table.reverse!
puts ""
puts "The first element of the Array is: #{Table.first}"
puts "Array elements are:"
print Table

Output

输出量

Array reverse! implementation
[20, 18, 16, 14, 12, 10, 8, 6, 4, 2]
The first element of the Array is: 20
Array elements are:
[20, 18, 16, 14, 12, 10, 8, 6, 4, 2]

Explanation:

说明:

In the above code, you can observe that this method works on Integer Array as well and we are reversing the contents of Array class instance with the help of Array.reverse! method. You can observe that after reversing the contents, the first element is 20 because this method is destructive and creates changes in the actual arrangements of contents in the Array instance.

在上面的代码中,您可以观察到该方法也适用于Integer Array,并且借助于Array.reverse ,我们正在反转Array类实例的内容 方法 。 您可以观察到,在反转内容之后,第一个元素为20,因为此方法具有破坏性,并会更改Array实例中内容的实际排列。

翻译自: https://www.includehelp.com/ruby/array-reverse-inverse-method-with-example.aspx

zemax微透镜阵列示例

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/378692.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Opencv实战【1】人脸检测并对ROI区域进行部分处理(变身乔碧萝!!!)

步骤: 1、利用Opencv自带的分类器检测人脸 预备知识:Haar特征分类器 Haar特征分类器就是一个XML文件,该文件中会描述人体各个部位的Haar特征值。包括人脸、眼睛、嘴唇等等。 Haar特征分类器存放地址: (找自己的安装…

【黑马甄选离线数仓day10_会员主题域开发_DWS和ADS层】

day10_会员主题域开发 会员主题_DWS和ADS层 DWS层开发 门店会员分类天表: 维度指标: 指标:新增注册会员数、累计注册会员数、新增消费会员数、累计消费会员数、新增复购会员数、累计复购会员数、活跃会员数、沉睡会员数、会员消费金额 维度: 时间维度&#xff08…

iPad和iPhone的app图标尺寸、用途、设置方法

下面是在iPhone专用程序、iPad专用程序和通用程序中使用图标文件的指导,由译言网翻译自苹果官方文档。原文 http://article.yeeyan.org/view/395/100567 注意:图标是你的程序包所必需的组成部分。如果你没有提供程 序所需的各种尺寸的图标,系…

18-傅里叶变化

以时间为参照就是时域分析,当然时间是动态变化的 而傅里叶变换是以频域为基准的,不用关心动态变化,只关心做了多少次而已,次数,频率 傅里叶说过,任何一个周期函数都可以用正弦函数堆叠起来形成。强吧&#…

java中访问修饰符_Java中的非访问修饰符是什么?

java中访问修饰符Java非访问修饰符 (Java non access modifiers) We have 7 non-access modifiers in Java. The name of these non-access modifiers are given below, Java中有7个非访问修饰符 。 这些非访问修饰符的名称如下所示: native 本机 synchronized 已同…

mui实现分享功能_MUI 分享功能(微信、QQ 、朋友圈)

配置文件:manifest.jsonplus ->plugins 下边"share": {/*配置应用使用分享功能,参考http://ask.dcloud.net.cn/article/27*/"qq": {"appid": "",/*腾讯QQ开放平台申请应用的AppID值*/"description"…

Java 注解学习笔记

转自:http://wanqiufeng.blog.51cto.com/409430/458883 一、什么是java注解 注解,顾名思义,注解,就是对某一事物进行添加注释说明,会存放一些信息,这些信息可能对以后某个时段来说是很有用处的。 Java注解又叫java标注…

Prime Palindromes

博客园速度非常不稳定,可能要考虑换地方了。虽然我非常喜欢博客园的模板和气氛。 这个题早就知道是怎么做的了。先求出回文数在再判断是不是素数。关键是不知道区间,那就把所有的全部求出来。虽然可能会超时,但是如果使用点技巧的话还是没问题…

Opencv——DFT变换(实现两个Mat的卷积以及显示Mat的频域图像)

DFT原理:(单变量离散傅里叶变换) 数学基础: 任何一个函数都可以转换成无数个正弦和余弦函数的和的形式。 通常观察傅里叶变换后的频域函数可以获得两个重要的信息:幅频曲线和相频曲线。 在数字图像处理中的作用&#…

python方法items_Python字典items()方法与示例

python方法items字典items()方法 (Dictionary items() Method) items() method is used to get the all items as a view object, the view object represents the key-value pair of the dictionary. items()方法用于获取所有项目作为视图对象,该视图对象表示字典的…

基于(Python下的OpenCV)图像处理的喷墨墨滴形状规范检测

通过图像处理,分析数码印花的喷头所喷出来的墨滴形状,与标准墨滴形状对比分析,来判断墨水及其喷头设备的状态,由两部分构成 PS:获取墨滴形状照片和标准墨滴形状照片都是手绘的,将就的看吧,主要…

const_iterator,const 迭代器

const 迭代器:是迭代器产量,该迭代器的值不能被修改,且需要初始化,初始化之后不能指向其他元素。const_iterator:当我们对const_iterator类型解引用时,返回一个const值,所以只能读,不能写。它是一种迭代器…

临时禁止令:诺西购摩托罗拉面临流产窘境?

近日,美国伊利诺伊州北区法院就中国华为起诉摩托罗拉公司和诺西一案作出初步裁决,禁止摩托罗拉解决方案公司(Motorola Solutions)向诺西披露华为的机密资料。此判决一出,各方评论纷沓而来。笔者认为,从诺西12以美元并购摩托罗拉部…

mysql replace into 语法_mysql Replace into与Insert update

Replace intoreplace into 跟 insert 功能类似,不同点在于:replace into 首先尝试插入数据到表中,1. 如果发现表中已经有此行数据(根据主键或者唯一索引判断)则先删除此行数据,然后插入新的数据。2. 否则,直接插入新数…

微机原理——指令系统——传送类指令(MOV、LEA、LDS、LES、LAHF、SAHF、XCHG、XLAT、PUSH、POP、PUSHF、POPF)

博主联系方式: QQ:1540984562 QQ交流群:892023501 群里会有往届的smarters和电赛选手,群里也会不时分享一些有用的资料,有问题可以在群里多问问。 【没事儿可以到我主页看看】https://blog.csdn.net/qq_42604176 传送类指令1&…

lastindexof方法_Java Vector lastIndexOf()方法与示例

lastindexof方法向量类别的lastIndexOf()方法 (Vector Class lastIndexOf() method) Syntax: 句法: public int lastIndexOf (Object ob);public int lastIndexOf (Object ob, int indices);lastIndexOf() method is available in java.util package. lastIndexOf(…

李开复:微博的价值在哪里

导读:微博可以改变社会现象,可以传播信息,可以帮助你成长,可以发出你的声音。它让我们能够人人成为记者,让每一个转发的人都变成了一个编辑 很多人问微博是抢了谁的生意,开心网还是人人网?其实它…

mysql 任务计划 /etc/cron.d_Linux /etc/cron.d增加定时任务

一般情况下我们添加计划任务时,都是直接修改/etc/crontab。但是,不建议这样做,/etc/cron.d目录就是为了分项目设置计划任务而创建的。例如,增加一项定时的备份任务,我们可以这样处理:在/etc/cron.d目录下新…

19-Harris角点检测

角点检测顾名思义,就是对类似顶点的检测,与边缘有所区别 边缘可能在某一方向上变化不是特别明显,但角点在任何方向上变换都很明显 cv2.cornerHarris(img,blockSize,ksize,k) cv2.cornerHarris(gray,2,3,0.04) 参数一:img&#xff…

微机原理——指令系统——算数运算指令(ADD、ADC、SUB、SBB、INC、DEC、NEG、CMP、MUL、IMUL、DIV、IDIV、CBW、CWD、BCD调整)

博主联系方式: QQ:1540984562 QQ交流群:892023501 群里会有往届的smarters和电赛选手,群里也会不时分享一些有用的资料,有问题可以在群里多问问。 算数运算指令1、加减法指令ADD、ADC 、SUB 、SBB 和增量减量指令INC、DEC、NEGADD…