老师请问一下函数式编程是什么,函数式编程的语言有哪些,函数式变成的语言的好处是什么,坏处是什么,还有副作用是什么?
函数式编程语言就是没有varible的语言,没有有对象的语言,这样在运行的时候程序的正确的输入一定会得到它预期的输出。不会因为内存地址指向的一些原因导致输入不能得到预期的输出。不知道是不是就等于面向对象的语言基本都不是函数式变成语言。python支持函数式编程但是不是一门纯函数式编程语言,因为他支持varible支持对象。
我对副作用的理解是一个程序的变量在运行的时候,对程序的input,这个程序输出的这个varible不是预期输出的varibale,被一些其他因素影响了,这就是programming language的副作用。不知道理解的对不对。
谢谢老师解答!!
老师CRF这块引的感觉有点跳跃,能不能把最大熵模型相关内容加一些,然后引到CRF这里
老师 dtype()与astype()这个两个函数之间有什么区别吗?
结果变成这样了
老师,这个假设修正法,我可以理解为开始假设是对的,接下来把所有错的列出来吗
有继承限制那怎么不直接定义类型呢还要定义泛型呢?
这种时怎么回事啊老师
瀑布流布局.rar
获取不到图片的高度,只能获取到第一张,其他的获取到的都是10,不知道是什么原因,麻烦老师帮看一下
老师,为什么我的MySQL那个黑窗口老是在半夜三更,或者是没动电脑的时候自己弹出来?莫名其妙的弹出来,显示了几条语句就消失了,就像闹鬼一样,太可怕了。。。是配置出问题了还是设置出问题了吗?
老师这个代码运行了两次set key1,怎么还是返回:OK ?
class MyNum():
def print123(self):
print(123)
老师,这啥意思
代码:
>>> a= [20,10,30,40]
>>> id(a)
2190345128840
>>> a.sort()
>>> b=a.sort()
>>> print(b)
None
问题:为什么b的输出为none
#文本对话框filedialog获取文件 from tkinter import* from tkinter.filedialog import* root=Tk();root.geometry("500x200+300+300") def test1(): filename = askopenfile(title="上传文件", initialdir="d:", filetypes=[("文本文件", ".txt")]) with open(filename, encoding='utf-8') as f: show["text"] = f.read() Button(root,text="选择读取的文本文件",command=test1).pack() show=Label(root,width=60,height=8,bg="green") show.pack() root.mainloop()
帮忙看一下报错的原因,然后怎么解决。
package BufferedInputStream_01; import java.io.*; /* * BufferedInputStream 缓冲字节流,用于提高读取效率 * 同时也是处理流(包装流) */ public class BufferInputStream_01 { public static void main(String[] args) throws IOException{ File sourceAddress = new File(File.separator+"Users"+File.separator+"luo"+File.separator); File sourceFile = new File(sourceAddress,"Downloads"+File.separator+"pconline1572649741588.dmg"); File destniyFile = new File(sourceAddress,"Desktop"+File.separator+sourceFile.getName()); File desktopDirectory=new File(sourceAddress,"Desktop"+File.separator); byte[]buffer = new byte[10]; FileInputStream fi = new FileInputStream(sourceFile); if(fi.markSupported()) { fi.mark(fi.available()); }else { System.out.println("不支持标记"); } FileOutputStream fo= new FileOutputStream(destniyFile); long currentTime = System.currentTimeMillis(); int times=0; int length=0; while((length=fi.read(buffer))!=-1) { times++; fo.write(buffer,0,length); } fo.flush(); long finishTime = System.currentTimeMillis(); System.out.println("中转"+times+"次\t使用字节流总共耗时"+(finishTime-currentTime)+"毫秒"); //fi.reset(); fi.close(); fi = new FileInputStream(sourceFile); Reader reader = new InputStreamReader(fi); FileOutputStream tempForWriter=new FileOutputStream(new File(desktopDirectory,"(1).dmg")); Writer writer = new OutputStreamWriter(tempForWriter); times=0; length=0; char[] bufferC = new char[buffer.length]; long readerTime = System.currentTimeMillis(); while((length=reader.read(bufferC))!=-1) { times++; writer.write(bufferC,0,length); /*也许用字符来复制就是打不开*/ } tempForWriter.flush(); writer.flush(); long writerTime = System.currentTimeMillis(); System.out.println("中转"+times+"次\t使用字符流总共耗时"+(writerTime-readerTime)+"毫秒"); times=0; length=0; byte[] buffer3 = new byte[buffer.length]; long bufferedTime = System.currentTimeMillis(); //fi.reset();不支持流标记 fi.close(); fi = new FileInputStream(sourceFile); BufferedInputStream bi = new BufferedInputStream(fi); FileOutputStream tempForBuffered = new FileOutputStream(new File(desktopDirectory,"(2).dmg")); BufferedOutputStream bo = new BufferedOutputStream(tempForBuffered); while((length=bi.read(buffer3))!=-1) { times++; bo.write(buffer3,0,length); /*不加长度,复制出来的文件一定打不开*/ } bo.flush(); tempForBuffered.flush(); long bufferedFinish = System.currentTimeMillis(); System.out.println("使用buffered总共读取了"+times+"次" +"\t耗时"+(bufferedFinish-bufferedTime)+"毫秒"); writer.close(); reader.close(); tempForWriter.close(); bo.close(); bi.close(); tempForBuffered.close(); fi.close(); fo.close(); System.out.println("拷贝完成"); } }
老师您好,我的是Mac系统,为什么字节流和缓冲字节流,复制应用程序后能打开,但是字符流就是打不开,我找不到错误的地方
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637