Created
April 12, 2015 14:54
-
-
Save shigemk2/758c44eb3f17ea250820 to your computer and use it in GitHub Desktop.
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
Welcome to Scala version 2.11.6 (OpenJDK 64-Bit Server VM, Java 1.7.0_75). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> mul2 _ [11G[K1 _ _[15G[K[8G[Kval mul2 = (x: Int, y: Int) => x * y[8G[Kdef mul1 (x: Int, y: Int): Int = x * y[33G[K = x * y[8G[Kval b: mString = ('a')[8G[Kdef mul1 (x: Int, y: Int) = x * y | |
mul1: (x: Int, y: Int)Int | |
scala> mul1 _ | |
res0: (Int, Int) => Int = <function2> | |
scala> mul1 _[13G[K.[13G[K.[13G[K[12G[K.[12G[K[11G[K[10G[K[9G[K[8G[K[1G[K (reverse-i-search)`': [1G[K (reverse-i-search)`m': def mul1 (x: Int, y: Int) = x * y[28G[57G[1G[K (reverse-i-search)`mu': def mul1 (x: Int, y: Int) = x * y[29G[58G[1G[K (reverse-i-search)`mul': def mul1 (x: Int, y: Int) = x * y[30G[59G[1G[K (reverse-i-search)`mul2': mul2 _ [27G[34G[1G[K (reverse-i-search)`mul2': val mul2 = (x: Int, y: Int) => x * y[31G[63G[1G[K scala> val mul2 = (x: Int, y: Int) => x * y[12G[8G[44G | |
mul2: (Int, Int) => Int = <function2> | |
scala> mul2. | |
apply asInstanceOf curried isInstanceOf toString tupled | |
scala> mul2. | |
apply asInstanceOf curried isInstanceOf toString tupled | |
scala> mul2. | |
apply asInstanceOf curried isInstanceOf toString tupled | |
scala> mul2.tupp[16G[K[15G[Kp[15G[K[14G[K[13G[Ktupled | |
def tupled: (T1, T2) => R | |
scala> mul2.tupled[18G[K[17G[K[16G[K[15G[K[14G[K[13G[K[12G[K _ | |
res1: () => (Int, Int) => Int = <function0> | |
scala> mul2 _[8G[Kval mul3 = mul1 _ | |
mul3: (Int, Int) => Int = <function2> | |
scala> mul3. | |
apply asInstanceOf curried isInstanceOf toString tupled | |
scala> mul3. | |
apply asInstanceOf curried isInstanceOf toString tupled | |
scala> mul3.toS[15G[K[14G[K[13G[KtoString | |
res2: String = <function2> | |
scala> mul3.toString[8G[9G[10G[11G[12G[11G.toString[K[11G1.toString[12G[11G.toString[K[11G1.toString[12G[21G | |
<console>:9: error: missing arguments for method mul1; | |
follow this method with `_' if you want to treat it as a partially applied function | |
mul1.toString | |
^ | |
scala> mul1.toString[20G[19G[18G[17G[16G[15G[14G[13G[12G[11G[10G[9G[8G[9G[10G[11G[12G[11G.toString[K[11G2.toString[12G[8G[K(mul1 _ [15G[K).<console>:1: error: ';' expected but ')' found. | |
_) | |
^ | |
[16G[K | |
res4: (Int, Int) => Int = <function2> | |
scala> (mul1 _).toString | |
res5: String = <function2> | |
scala> (mul1 _).toString[24G[K[23G[K[22G[K[21G[K[20G[K[19G[K[18G[K[17G[K<console>:1: error: ';' expected but ')' found. | |
_) | |
^ | |
| toString | |
res6: String = <function2> | |
scala> toString[8G[K(mul1 _).toS<console>:1: error: ';' expected but ')' found. | |
_) | |
^ | |
<console>:9: error: value toS is not a member of (Int, Int) => Int | |
(mul1 _).toS | |
^ | |
scala> (mul1 _).toString | |
res8: String = <function2> | |
scala> (mul1 _).toString[8G[Kj[8G[Kj | |
java javax jline junk | |
scala> j[8G[Knew [8Gvnew [9Ganew [10Grnew [11G new [12G[11Gnew [K[11G[10Gnew [K[10Glnew [11G new [12Ganew [13G new [14G=new [15G new [16G[20GJ[8G[Kimport javax.swing.* | |
<console>:7: error: object * is not a member of package javax.swing | |
import javax.swing.* | |
^ | |
scala> import javax.swing.*[8G[9G[10G[11G[12G[13G[14G[15G[16G[17G[18G[19G[20G[28G[27G[K_ | |
import javax.swing._ | |
scala> val a = new Sw[21G[K[20G[KJFra[23G[K[22G[K[21G[K[20G[Kj[20G[Kj | |
java javax jline junk | |
scala> val a = new j[20G[KJFrame()[27G')[28G')[29G[28Gt')[29Ge')[30Gs')[31Gt')[32G[8G[34G[33G[34G | |
<console>:1: error: unclosed character literal | |
val a = new JFrame('test') | |
^ | |
scala> val a = new JFrame('test')[8G[9G[10G[11G[12G[13G[14G[15G[16G[17G[18G[19G[20G[21G[22G[23G[24G[25G[26G[27G[28G[29G[30G[31G[32G[33G[32G[31G[30G[29G[28G[27Gtest')[K[27G"test')[28G[34G[33G[32G)[K[32G")[33G[34G | |
a: javax.swing.JFrame = javax.swing.JFrame[frame0,0,0,0x0,invalid,hidden,layout=java.awt.BorderLayout,title=test,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,0,0x0,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true] | |
scala> a. | |
action getMaximumSize paintAll | |
add getMenuBar paintComponents | |
addComponentListener getMinimumSize postEvent | |
addContainerListener getModalExclusionType preferredSize | |
addFocusListener getMostRecentFocusOwner prepareImage | |
addHierarchyBoundsListener getMouseListeners print | |
addHierarchyListener getMouseMotionListeners printAll | |
addInputMethodListener getMousePosition printComponents | |
addKeyListener getMouseWheelListeners remove | |
addMouseListener getName removeAll | |
addMouseMotionListener getOpacity removeComponentListener | |
addMouseWheelListener getOwnedWindows removeContainerListener | |
addNotify getOwner removeFocusListener | |
addPropertyChangeListener getParent removeHierarchyBoundsListener | |
addWindowFocusListener getPeer removeHierarchyListener | |
addWindowListener getPreferredSize removeInputMethodListener | |
addWindowStateListener getPropertyChangeListeners removeKeyListener | |
applyComponentOrientation getRootPane removeMouseListener | |
applyResourceBundle getShape removeMouseMotionListener | |
areFocusTraversalKeysSet getSize removeMouseWheelListener | |
asInstanceOf getState removeNotify | |
bounds getTitle removePropertyChangeListener | |
checkImage getToolkit removeWindowFocusListener | |
contains getTransferHandler removeWindowListener | |
countComponents getTreeLock removeWindowStateListener | |
createBufferStrategy getType repaint | |
createImage getWarningString requestFocus | |
createVolatileImage getWidth requestFocusInWindow | |
deliverEvent getWindowFocusListeners reshape | |
disable getWindowListeners resize | |
dispatchEvent getWindowStateListeners revalidate | |
dispose getX setAlwaysOnTop | |
doLayout getY setAutoRequestFocus | |
enable gotFocus setBackground | |
enableInputMethods handleEvent setBounds | |
findComponentAt hasFocus setComponentOrientation | |
firePropertyChange hide setComponentZOrder | |
getAccessibleContext imageUpdate setContentPane | |
getAlignmentX insets setCursor | |
getAlignmentY inside setDefaultCloseOperation | |
getBackground invalidate setDropTarget | |
getBaseline isActive setEnabled | |
getBaselineResizeBehavior isAlwaysOnTop setExtendedState | |
getBounds isAlwaysOnTopSupported setFocusCycleRoot | |
getBufferStrategy isAncestorOf setFocusTraversalKeys | |
getColorModel isAutoRequestFocus setFocusTraversalKeysEnabled | |
getComponent isBackgroundSet setFocusTraversalPolicy | |
getComponentAt isCursorSet setFocusTraversalPolicyProvider | |
getComponentCount isDisplayable setFocusable | |
getComponentListeners isDoubleBuffered setFocusableWindowState | |
getComponentOrientation isEnabled setFont | |
getComponentZOrder isFocusCycleRoot setForeground | |
getComponents isFocusOwner setGlassPane | |
getContainerListeners isFocusTraversable setIconImage | |
getContentPane isFocusTraversalPolicyProvider setIconImages | |
getCursor isFocusTraversalPolicySet setIgnoreRepaint | |
getCursorType isFocusable setJMenuBar | |
getDefaultCloseOperation isFocusableWindow setLayeredPane | |
getDropTarget isFocused setLayout | |
getExtendedState isFontSet setLocale | |
getFocusCycleRootAncestor isForegroundSet setLocation | |
getFocusListeners isInstanceOf setLocationByPlatform | |
getFocusOwner isLightweight setLocationRelativeTo | |
getFocusTraversalKeys isLocationByPlatform setMaximizedBounds | |
getFocusTraversalKeysEnabled isMaximumSizeSet setMaximumSize | |
getFocusTraversalPolicy isMinimumSizeSet setMenuBar | |
getFocusableWindowState isOpaque setMinimumSize | |
getFont isPreferredSizeSet setModalExclusionType | |
getFontMetrics isResizable setName | |
getForeground isShowing setOpacity | |
getGlassPane isUndecorated setPreferredSize | |
getGraphics isValid setResizable | |
getGraphicsConfiguration isValidateRoot setShape | |
getHeight isVisible setSize | |
getHierarchyBoundsListeners keyDown setState | |
getHierarchyListeners keyUp setTitle | |
getIconImage layout setTransferHandler | |
getIconImages list setType | |
getIgnoreRepaint locate setUndecorated | |
getInputContext location setVisible | |
getInputMethodListeners lostFocus show | |
getInputMethodRequests minimumSize size | |
getInsets mouseDown toBack | |
getJMenuBar mouseDrag toFront | |
getKeyListeners mouseEnter toString | |
getLayeredPane mouseExit transferFocus | |
getLayout mouseMove transferFocusBackward | |
getListeners mouseUp transferFocusDownCycle | |
getLocale move transferFocusUpCycle | |
getLocation nextFocus update | |
getLocationOnScreen pack validate | |
getMaximizedBounds paint | |
scala> a. | |
action getMaximumSize paintAll | |
add getMenuBar paintComponents | |
addComponentListener getMinimumSize postEvent | |
addContainerListener getModalExclusionType preferredSize | |
addFocusListener getMostRecentFocusOwner prepareImage | |
addHierarchyBoundsListener getMouseListeners print | |
addHierarchyListener getMouseMotionListeners printAll | |
addInputMethodListener getMousePosition printComponents | |
addKeyListener getMouseWheelListeners remove | |
addMouseListener getName removeAll | |
addMouseMotionListener getOpacity removeComponentListener | |
addMouseWheelListener getOwnedWindows removeContainerListener | |
addNotify getOwner removeFocusListener | |
addPropertyChangeListener getParent removeHierarchyBoundsListener | |
addWindowFocusListener getPeer removeHierarchyListener | |
addWindowListener getPreferredSize removeInputMethodListener | |
addWindowStateListener getPropertyChangeListeners removeKeyListener | |
applyComponentOrientation getRootPane removeMouseListener | |
applyResourceBundle getShape removeMouseMotionListener | |
areFocusTraversalKeysSet getSize removeMouseWheelListener | |
asInstanceOf getState removeNotify | |
bounds getTitle removePropertyChangeListener | |
checkImage getToolkit removeWindowFocusListener | |
contains getTransferHandler removeWindowListener | |
countComponents getTreeLock removeWindowStateListener | |
createBufferStrategy getType repaint | |
createImage getWarningString requestFocus | |
createVolatileImage getWidth requestFocusInWindow | |
deliverEvent getWindowFocusListeners reshape | |
disable getWindowListeners resize | |
dispatchEvent getWindowStateListeners revalidate | |
dispose getX setAlwaysOnTop | |
doLayout getY setAutoRequestFocus | |
enable gotFocus setBackground | |
enableInputMethods handleEvent setBounds | |
findComponentAt hasFocus setComponentOrientation | |
firePropertyChange hide setComponentZOrder | |
getAccessibleContext imageUpdate setContentPane | |
getAlignmentX insets setCursor | |
getAlignmentY inside setDefaultCloseOperation | |
getBackground invalidate setDropTarget | |
getBaseline isActive setEnabled | |
getBaselineResizeBehavior isAlwaysOnTop setExtendedState | |
getBounds isAlwaysOnTopSupported setFocusCycleRoot | |
getBufferStrategy isAncestorOf setFocusTraversalKeys | |
getColorModel isAutoRequestFocus setFocusTraversalKeysEnabled | |
getComponent isBackgroundSet setFocusTraversalPolicy | |
getComponentAt isCursorSet setFocusTraversalPolicyProvider | |
getComponentCount isDisplayable setFocusable | |
getComponentListeners isDoubleBuffered setFocusableWindowState | |
getComponentOrientation isEnabled setFont | |
getComponentZOrder isFocusCycleRoot setForeground | |
getComponents isFocusOwner setGlassPane | |
getContainerListeners isFocusTraversable setIconImage | |
getContentPane isFocusTraversalPolicyProvider setIconImages | |
getCursor isFocusTraversalPolicySet setIgnoreRepaint | |
getCursorType isFocusable setJMenuBar | |
getDefaultCloseOperation isFocusableWindow setLayeredPane | |
getDropTarget isFocused setLayout | |
getExtendedState isFontSet setLocale | |
getFocusCycleRootAncestor isForegroundSet setLocation | |
getFocusListeners isInstanceOf setLocationByPlatform | |
getFocusOwner isLightweight setLocationRelativeTo | |
getFocusTraversalKeys isLocationByPlatform setMaximizedBounds | |
getFocusTraversalKeysEnabled isMaximumSizeSet setMaximumSize | |
getFocusTraversalPolicy isMinimumSizeSet setMenuBar | |
getFocusableWindowState isOpaque setMinimumSize | |
getFont isPreferredSizeSet setModalExclusionType | |
getFontMetrics isResizable setName | |
getForeground isShowing setOpacity | |
getGlassPane isUndecorated setPreferredSize | |
getGraphics isValid setResizable | |
getGraphicsConfiguration isValidateRoot setShape | |
getHeight isVisible setSize | |
getHierarchyBoundsListeners keyDown setState | |
getHierarchyListeners keyUp setTitle | |
getIconImage layout setTransferHandler | |
getIconImages list setType | |
getIgnoreRepaint locate setUndecorated | |
getInputContext location setVisible | |
getInputMethodListeners lostFocus show | |
getInputMethodRequests minimumSize size | |
getInsets mouseDown toBack | |
getJMenuBar mouseDrag toFront | |
getKeyListeners mouseEnter toString | |
getLayeredPane mouseExit transferFocus | |
getLayout mouseMove transferFocusBackward | |
getListeners mouseUp transferFocusDownCycle | |
getLocale move transferFocusUpCycle | |
getLocation nextFocus update | |
getLocationOnScreen pack validate | |
getMaximizedBounds paint | |
scala> a.setVisi[16G[K[15G[K[14G[K[13G[K[12G[K[11G[K[10G[KsetVisible | |
def setVisible(Boolean): Unit | |
scala> a.setVisible = true[26G[K[25G[K[24G[K[23G[K[22G[K[21G[K[20G[K()[21Gt)[22Gr)[23Gu)[24Ge)[25G[8G[26G][26G[K | |
scala> a.setVisible(true)[25G[24G[23G[22G[21G[20G[19G[18G[17G[16G[15G[14G[13G[12G[11G[10G[11G[12G[13G[14G[15G[16G[17G[18G[19G[20G[21G[22G[23G[24G[25G[24G)[K[24G[23G)[K[23G[22G)[K[22G[21G)[K[21Gf)[22Ga)[23Gl)[24Gs)[25Ge)[26G[27G | |
scala> a.setVisible(false)[8G[9G[10G[K | |
action getMaximumSize paintAll | |
add getMenuBar paintComponents | |
addComponentListener getMinimumSize postEvent | |
addContainerListener getModalExclusionType preferredSize | |
addFocusListener getMostRecentFocusOwner prepareImage | |
addHierarchyBoundsListener getMouseListeners print | |
addHierarchyListener getMouseMotionListeners printAll | |
addInputMethodListener getMousePosition printComponents | |
addKeyListener getMouseWheelListeners remove | |
addMouseListener getName removeAll | |
addMouseMotionListener getOpacity removeComponentListener | |
addMouseWheelListener getOwnedWindows removeContainerListener | |
addNotify getOwner removeFocusListener | |
addPropertyChangeListener getParent removeHierarchyBoundsListener | |
addWindowFocusListener getPeer removeHierarchyListener | |
addWindowListener getPreferredSize removeInputMethodListener | |
addWindowStateListener getPropertyChangeListeners removeKeyListener | |
applyComponentOrientation getRootPane removeMouseListener | |
applyResourceBundle getShape removeMouseMotionListener | |
areFocusTraversalKeysSet getSize removeMouseWheelListener | |
asInstanceOf getState removeNotify | |
bounds getTitle removePropertyChangeListener | |
checkImage getToolkit removeWindowFocusListener | |
contains getTransferHandler removeWindowListener | |
countComponents getTreeLock removeWindowStateListener | |
createBufferStrategy getType repaint | |
createImage getWarningString requestFocus | |
createVolatileImage getWidth requestFocusInWindow | |
deliverEvent getWindowFocusListeners reshape | |
disable getWindowListeners resize | |
dispatchEvent getWindowStateListeners revalidate | |
dispose getX setAlwaysOnTop | |
doLayout getY setAutoRequestFocus | |
enable gotFocus setBackground | |
enableInputMethods handleEvent setBounds | |
findComponentAt hasFocus setComponentOrientation | |
firePropertyChange hide setComponentZOrder | |
getAccessibleContext imageUpdate setContentPane | |
getAlignmentX insets setCursor | |
getAlignmentY inside setDefaultCloseOperation | |
getBackground invalidate setDropTarget | |
getBaseline isActive setEnabled | |
getBaselineResizeBehavior isAlwaysOnTop setExtendedState | |
getBounds isAlwaysOnTopSupported setFocusCycleRoot | |
getBufferStrategy isAncestorOf setFocusTraversalKeys | |
getColorModel isAutoRequestFocus setFocusTraversalKeysEnabled | |
getComponent isBackgroundSet setFocusTraversalPolicy | |
getComponentAt isCursorSet setFocusTraversalPolicyProvider | |
getComponentCount isDisplayable setFocusable | |
getComponentListeners isDoubleBuffered setFocusableWindowState | |
getComponentOrientation isEnabled setFont | |
getComponentZOrder isFocusCycleRoot setForeground | |
getComponents isFocusOwner setGlassPane | |
getContainerListeners isFocusTraversable setIconImage | |
getContentPane isFocusTraversalPolicyProvider setIconImages | |
getCursor isFocusTraversalPolicySet setIgnoreRepaint | |
getCursorType isFocusable setJMenuBar | |
getDefaultCloseOperation isFocusableWindow setLayeredPane | |
getDropTarget isFocused setLayout | |
getExtendedState isFontSet setLocale | |
getFocusCycleRootAncestor isForegroundSet setLocation | |
getFocusListeners isInstanceOf setLocationByPlatform | |
getFocusOwner isLightweight setLocationRelativeTo | |
getFocusTraversalKeys isLocationByPlatform setMaximizedBounds | |
getFocusTraversalKeysEnabled isMaximumSizeSet setMaximumSize | |
getFocusTraversalPolicy isMinimumSizeSet setMenuBar | |
getFocusableWindowState isOpaque setMinimumSize | |
getFont isPreferredSizeSet setModalExclusionType | |
getFontMetrics isResizable setName | |
getForeground isShowing setOpacity | |
getGlassPane isUndecorated setPreferredSize | |
getGraphics isValid setResizable | |
getGraphicsConfiguration isValidateRoot setShape | |
getHeight isVisible setSize | |
getHierarchyBoundsListeners keyDown setState | |
getHierarchyListeners keyUp setTitle | |
getIconImage layout setTransferHandler | |
getIconImages list setType | |
getIgnoreRepaint locate setUndecorated | |
getInputContext location setVisible | |
getInputMethodListeners lostFocus show | |
getInputMethodRequests minimumSize size | |
getInsets mouseDown toBack | |
getJMenuBar mouseDrag toFront | |
getKeyListeners mouseEnter toString | |
getLayeredPane mouseExit transferFocus | |
getLayout mouseMove transferFocusBackward | |
getListeners mouseUp transferFocusDownCycle | |
getLocale move transferFocusUpCycle | |
getLocation nextFocus update | |
getLocationOnScreen pack validate | |
getMaximizedBounds paint | |
scala> a.size | |
warning: there was one deprecation warning; re-run with -deprecation for details | |
res11: java.awt.Dimension = java.awt.Dimension[width=10,height=41] | |
scala> a.size[13G[K[12G[K[11G[K[10G[Ksize | |
def size(): Dimension | |
scala> a.size() | |
warning: there was one deprecation warning; re-run with -deprecation for details | |
res12: java.awt.Dimension = java.awt.Dimension[width=10,height=41] | |
scala> val mul2 = (x: Int, y: Int) => x * y | |
mul2: (Int, Int) => Int = <function2> | |
scala> mu[9G[K[8G[Kmu[9G[K[8G[Kval b[12G[Ka = mul([19G[K2(3_[22G[K,_) | |
<console>:11: error: missing parameter type for expanded function ((x$1) => mul2(3, x$1)) | |
val a = mul2(3,_) | |
^ | |
scala> val a = mul2(3,_)[24G[23G[24G[8G[9G[10G[11G[12G[13G[14G[15G[16G[17G[18G[19G[20G[21G[22G[23G[24G[25G[24G[23G[22G[21G[20G[19G[8G[9G[10G[11G[12G[13G[14G[15G[16G[17G[18G[19G[20G[19G(3,_)[K[19G1(3,_)[20G[25G | |
<console>:11: error: missing parameter type for expanded function ((x$1) => mul1(3, x$1)) | |
val a = mul1(3,_) | |
^ | |
scala> val a = mul1(3,_)[8Gal a = mul1(3,_)[K[8Gl a = mul1(3,_)[K[8G a = mul1(3,_)[K[8Ga = mul1(3,_)[K[8G = mul1(3,_)[K[8G= mul1(3,_)[K[8G mul1(3,_)[K[8G[18G[17G[16G)[K[16G3)[17G[18G | |
res13: Int = 9 | |
scala> mul1(3,3)[8G[Kval a = mul1(3,_)[8G[K mul1(3,3)[8Gv mul1(3,3)[9Ga mul1(3,3)[10Gl mul1(3,3)[11G mul1(3,3)[12Ga mul1(3,3)[13G mul1(3,3)[14G= mul1(3,3)[15G[25G[24G[23G)[K[23G_)[24G[25G | |
<console>:11: error: missing parameter type for expanded function ((x$1) => mul1(3, x$1)) | |
val a = mul1(3,_) | |
^ | |
scala> val a = mul1(3,_) | |
<console>:11: error: missing parameter type for expanded function ((x$1) => mul1(3, x$1)) | |
val a = mul1(3,_) | |
^ | |
scala> val mul3 = (x: Int) => (y: Int) => x * y | |
mul3: Int => (Int => Int) = <function1> | |
scala> val a = mul3(3)[8G[23G | |
a: Int => Int = <function1> | |
scala> val a = mul3(3)[8G[9G[10G[11G[12G[13G[8G[Ka(3)[11G[12G | |
res14: Int = 9 | |
scala> a(3)[8G[Kval a = mul3(3)[8G[9G[10G[11G[12G[13G[23G[8G[23G()[24G_)[25G[26G | |
a: Int => Int = <function1> | |
scala> val a = mul3(3)(_)[8G[9G[10G[11G[12G[13G[K(2)[8Gal a(2)[K[8Gl a(2)[K[8G a(2)[K[8Ga(2)[K[8G[12G | |
res15: Int = 6 | |
scala> def f(g: (Int, Int) => Int) = g(2, 3) | |
f: (g: (Int, Int) => Int)Int | |
scala> | |
scala> def add(x: Int, y: Int) = x + y | |
add: (x: Int, y: Int)Int | |
scala> val mul = (x: Int, y: Int) => x * y | |
mul: (Int, Int) => Int = <function2> | |
scala> | |
scala> // メソッドでも変数でもどちらでも渡せる | |
scala> println(f(add)) | |
5 | |
scala> println(f(mul)) | |
6 | |
scala> println(f(mul))[18G[Kadd))[8G[K// メソッドでも変数でもどちらでも渡せる[8G[Kprintln(f(add)) | |
5 | |
scala> println(f(add))[18G[Kmul)) | |
6 | |
scala> お[9G[K[8G[Kお[8G[Kval b[12G[K;[12G[Kp = _+_ | |
<console>:10: error: missing parameter type for expanded function ((x$1, x$2) => x$1.$plus(x$2)) | |
val p = _+_ | |
^ | |
<console>:10: error: missing parameter type for expanded function ((x$1: <error>, x$2) => x$1.$plus(x$2)) | |
val p = _+_ | |
^ | |
scala> val p = _+_[18G[17G[16G[15G[14G[13G[12G[13G[14G[15G[16G[17G.+_[18G[19G._[20G[21G | |
<console>:1: error: identifier expected but '_' found. | |
val p = _.+._ | |
^ | |
scala> val p = _.+._[20G[19G_[K[19G[18G[17G+_[K[17G:+_[18GI+_[19Gn+_[20Gt+_[21G[23G:Int[26G[25G[24G[23G[22G(_:Int[23G[28G)[8G[9G[10G[11G[12G[13G[14G[15G[16G(_:Int+(_:Int)[17G[18G[19G[20G[21G[22G9+(_:Int)[23G.+(_:Int)[24G[23G+(_:Int)[K[23G[22G+(_:Int)[K[22G)+(_:Int)[23G.+(_:Int)[24G[25G.(_:Int)[26G[33G | |
<console>:1: error: identifier expected but '(' found. | |
val p = (_:Int).+.(_:Int) | |
^ | |
scala> val p = (_:Int).+.(_:Int)[32G[31G[30G[29G[28G[27G[26G[25G[24G[23G[22G[21G[20G[19G[20G[21G[22G[23G[24G[23G+.(_:Int)[K[23G[24G[25G_:Int)[K[25G[24G_:Int)[K[24G(_:Int)[25G[31G | |
p: (Int, Int) => Int = <function2> | |
scala> p(1)(3) | |
<console>:12: error: not enough arguments for method apply: (v1: Int, v2: Int)Int in trait Function2. | |
Unspecified value parameter v2. | |
p(1)(3) | |
^ | |
scala> p(1)(3)[8G[9G[10G[9G[10G[11G(3)[K[11G3)[K[11G,3)[12G 3)[13G[15G | |
res21: Int = 4 | |
scala> p. | |
apply asInstanceOf curried isInstanceOf toString tupled | |
scala> p. | |
apply asInstanceOf curried isInstanceOf toString tupled | |
scala> p.curryh[15G[K[14G[Ki[14G[K[13G[K[12G[K[11G[K[10G[Kcurried | |
def curried: T1 => T2 => R | |
scala> p.curried | |
res22: Int => (Int => Int) = <function1> | |
scala> p.curried(1)(2~)[23G[K[22G[K) | |
res23: Int = 3 | |
scala> p.curried(1)(2)[22G[K[21G[K[20G[K[8G[20G | |
res24: Int => Int = <function1> | |
scala> p.curried(1)[8Gvp.curried(1)[9Gap.curried(1)[10Glp.curried(1)[11G p.curried(1)[12Gpp.curried(1)[13G1p.curried(1)[14G p.curried(1)[15G=p.curried(1)[16G p.curried(1)[17G[29G | |
p1: Int => Int = <function1> | |
scala> p1(3) | |
res25: Int = 4 | |
scala> o[8G[K// オペランドの省略 | |
scala> // _を使うとカリー化されない | |
scala> List(1,2,3,4,5,6,7,8,9) [31G[K [31G[K.<console>:1: error: ';' expected but ')' found. | |
9) | |
^ | |
% * - > >> ^ isInstanceOf toChar toFloat toLong toString unary_- | | |
& + / >= >>> asInstanceOf toByte toDouble toInt toShort unary_+ unary_~ | |
scala> List(1,2,3,4,5,6,7,8,9).fi[33G[K[32G[K[31G[K. | |
!= & - << == >> asInstanceOf hashCode toChar toInt toString unary_~ | |
## * / <= > >>> equals isInstanceOf toDouble toLong unary_+ | | |
% + < <init> >= ^ getClass toByte toFloat toShort unary_- | |
scala> List(1,2,3,4,5,6,7,8,9). | |
!= & - << == >> asInstanceOf hashCode toChar toInt toString unary_~ | |
## * / <= > >>> equals isInstanceOf toDouble toLong unary_+ | | |
% + < <init> >= ^ getClass toByte toFloat toShort unary_- | |
scala> List(1,2,3,4,5,6,7,8,9). | |
!= & - << == >> asInstanceOf hashCode toChar toInt toString unary_~ | |
## * / <= > >>> equals isInstanceOf toDouble toLong unary_+ | | |
% + < <init> >= ^ getClass toByte toFloat toShort unary_- | |
scala> List(1,2,3,4,5,6,7,8,9). | |
!= & - << == >> asInstanceOf hashCode toChar toInt toString unary_~ | |
## * / <= > >>> equals isInstanceOf toDouble toLong unary_+ | | |
% + < <init> >= ^ getClass toByte toFloat toShort unary_- | |
scala> List(1,2,3,4,5,6,7,8,9).filter()[39G_)[40G )[41G>)[42G )[43G5)[44G[45G | |
res26: List[Int] = List(6, 7, 8, 9) | |
scala> List(1,2,3,4,5,6,7,8,9).filter(_ > 5)[44G[K[43G[K[42G[K[41G[K[40G[K[39G[K[38G[K[37G[K[36G[K[35G[K[34G[K[33G[K[32G[K<console>:1: error: ';' expected but ')' found. | |
9) | |
^ | |
!= & - << == >> asInstanceOf hashCode toChar toInt toString unary_~ | |
## * / <= > >>> equals isInstanceOf toDouble toLong unary_+ | | |
% + < <init> >= ^ getClass toByte toFloat toShort unary_- | |
scala> List(1,2,3,4,5,6,7,8,9). | |
!= & - << == >> asInstanceOf hashCode toChar toInt toString unary_~ | |
## * / <= > >>> equals isInstanceOf toDouble toLong unary_+ | | |
% + < <init> >= ^ getClass toByte toFloat toShort unary_- | |
scala> List(1,2,3,4,5,6,7,8,9). | |
!= & - << == >> asInstanceOf hashCode toChar toInt toString unary_~ | |
## * / <= > >>> equals isInstanceOf toDouble toLong unary_+ | | |
% + < <init> >= ^ getClass toByte toFloat toShort unary_- | |
scala> List(1,2,3,4,5,6,7,8,9). | |
!= & - << == >> asInstanceOf hashCode toChar toInt toString unary_~ | |
## * / <= > >>> equals isInstanceOf toDouble toLong unary_+ | | |
% + < <init> >= ^ getClass toByte toFloat toShort unary_- | |
scala> List(1,2,3,4,5,6,7,8,9). | |
!= & - << == >> asInstanceOf hashCode toChar toInt toString unary_~ | |
## * / <= > >>> equals isInstanceOf toDouble toLong unary_+ | | |
% + < <init> >= ^ getClass toByte toFloat toShort unary_- | |
scala> List(1,2,3,4,5,6,7,8,9).[8GvList(1,2,3,4,5,6,7,8,9).[9GaList(1,2,3,4,5,6,7,8,9).[10GrList(1,2,3,4,5,6,7,8,9).[11G List(1,2,3,4,5,6,7,8,9).[12GlList(1,2,3,4,5,6,7,8,9).[13G[12GList(1,2,3,4,5,6,7,8,9).[K[12GaList(1,2,3,4,5,6,7,8,9).[13G List(1,2,3,4,5,6,7,8,9).[14G=List(1,2,3,4,5,6,7,8,9).[15G List(1,2,3,4,5,6,7,8,9).[16G[40G[39G[K | |
a: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9) | |
scala> var a = List(1,2,3,4,5,6,7,8,9)[8G[9G[10G[11G[12G[13G[12G = List(1,2,3,4,5,6,7,8,9)[K[12Gl = List(1,2,3,4,5,6,7,8,9)[13G[39G | |
l: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9) | |
scala> var l = List(1,2,3,4,5,6,7,8,9)[8G[9G[10G[11G[12G[13G[12G = List(1,2,3,4,5,6,7,8,9)[K[12G[11G = List(1,2,3,4,5,6,7,8,9)[K[11G[10G = List(1,2,3,4,5,6,7,8,9)[K[10Gl = List(1,2,3,4,5,6,7,8,9)[11G = List(1,2,3,4,5,6,7,8,9)[12Ga = List(1,2,3,4,5,6,7,8,9)[13G = List(1,2,3,4,5,6,7,8,9)[14G[13G = List(1,2,3,4,5,6,7,8,9)[K[13G[39G | |
a: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9) | |
scala> a [9G[K. | |
++ count indexOfSlice mkString runWith toBuffer | |
++: diff indexWhere nonEmpty sameElements toIndexedSeq | |
+: distinct indices orElse scan toIterable | |
/: drop init padTo scanLeft toIterator | |
:+ dropRight inits par scanRight toList | |
:: dropWhile intersect partition segmentLength toMap | |
::: endsWith isDefinedAt patch seq toSeq | |
:\ exists isEmpty permutations size toSet | |
addString filter isInstanceOf prefixLength slice toStream | |
aggregate filterNot isTraversableAgain product sliding toString | |
andThen find iterator productArity sortBy toTraversable | |
apply flatMap last productElement sortWith toVector | |
applyOrElse flatten lastIndexOf productIterator sorted transpose | |
asInstanceOf fold lastIndexOfSlice productPrefix span union | |
canEqual foldLeft lastIndexWhere reduce splitAt unzip | |
collect foldRight lastOption reduceLeft startsWith unzip3 | |
collectFirst forall length reduceLeftOption stringPrefix updated | |
combinations foreach lengthCompare reduceOption sum view | |
companion genericBuilder lift reduceRight tail withFilter | |
compose groupBy map reduceRightOption tails zip | |
contains grouped mapConserve repr take zipAll | |
containsSlice hasDefiniteSize max reverse takeRight zipWithIndex | |
copyToArray head maxBy reverseIterator takeWhile | |
copyToBuffer headOption min reverseMap to | |
corresponds indexOf minBy reverse_::: toArray | |
scala> a. | |
++ count indexOfSlice mkString runWith toBuffer | |
++: diff indexWhere nonEmpty sameElements toIndexedSeq | |
+: distinct indices orElse scan toIterable | |
/: drop init padTo scanLeft toIterator | |
:+ dropRight inits par scanRight toList | |
:: dropWhile intersect partition segmentLength toMap | |
::: endsWith isDefinedAt patch seq toSeq | |
:\ exists isEmpty permutations size toSet | |
addString filter isInstanceOf prefixLength slice toStream | |
aggregate filterNot isTraversableAgain product sliding toString | |
andThen find iterator productArity sortBy toTraversable | |
apply flatMap last productElement sortWith toVector | |
applyOrElse flatten lastIndexOf productIterator sorted transpose | |
asInstanceOf fold lastIndexOfSlice productPrefix span union | |
canEqual foldLeft lastIndexWhere reduce splitAt unzip | |
collect foldRight lastOption reduceLeft startsWith unzip3 | |
collectFirst forall length reduceLeftOption stringPrefix updated | |
combinations foreach lengthCompare reduceOption sum view | |
companion genericBuilder lift reduceRight tail withFilter | |
compose groupBy map reduceRightOption tails zip | |
contains grouped mapConserve repr take zipAll | |
containsSlice hasDefiniteSize max reverse takeRight zipWithIndex | |
copyToArray head maxBy reverseIterator takeWhile | |
copyToBuffer headOption min reverseMap to | |
corresponds indexOf minBy reverse_::: toArray | |
scala> a. | |
++ count indexOfSlice mkString runWith toBuffer | |
++: diff indexWhere nonEmpty sameElements toIndexedSeq | |
+: distinct indices orElse scan toIterable | |
/: drop init padTo scanLeft toIterator | |
:+ dropRight inits par scanRight toList | |
:: dropWhile intersect partition segmentLength toMap | |
::: endsWith isDefinedAt patch seq toSeq | |
:\ exists isEmpty permutations size toSet | |
addString filter isInstanceOf prefixLength slice toStream | |
aggregate filterNot isTraversableAgain product sliding toString | |
andThen find iterator productArity sortBy toTraversable | |
apply flatMap last productElement sortWith toVector | |
applyOrElse flatten lastIndexOf productIterator sorted transpose | |
asInstanceOf fold lastIndexOfSlice productPrefix span union | |
canEqual foldLeft lastIndexWhere reduce splitAt unzip | |
collect foldRight lastOption reduceLeft startsWith unzip3 | |
collectFirst forall length reduceLeftOption stringPrefix updated | |
combinations foreach lengthCompare reduceOption sum view | |
companion genericBuilder lift reduceRight tail withFilter | |
compose groupBy map reduceRightOption tails zip | |
contains grouped mapConserve repr take zipAll | |
containsSlice hasDefiniteSize max reverse takeRight zipWithIndex | |
copyToArray head maxBy reverseIterator takeWhile | |
copyToBuffer headOption min reverseMap to | |
corresponds indexOf minBy reverse_::: toArray | |
scala> a.fil[12G[K[11G[K[10G[Kfilter | |
filter filterNot | |
scala> a.filter | |
def filter(p: A => Boolean): Repr | |
scala> a.filter[8G[9G[10G[9Gfilter[K[9G[K [9G[Ka | |
a add akka asInstanceOf actors annotation | |
scala> aa[9G[K fi[11G[K[10G[K[9G[K. | |
++ count indexOfSlice mkString runWith toBuffer | |
++: diff indexWhere nonEmpty sameElements toIndexedSeq | |
+: distinct indices orElse scan toIterable | |
/: drop init padTo scanLeft toIterator | |
:+ dropRight inits par scanRight toList | |
:: dropWhile intersect partition segmentLength toMap | |
::: endsWith isDefinedAt patch seq toSeq | |
:\ exists isEmpty permutations size toSet | |
addString filter isInstanceOf prefixLength slice toStream | |
aggregate filterNot isTraversableAgain product sliding toString | |
andThen find iterator productArity sortBy toTraversable | |
apply flatMap last productElement sortWith toVector | |
applyOrElse flatten lastIndexOf productIterator sorted transpose | |
asInstanceOf fold lastIndexOfSlice productPrefix span union | |
canEqual foldLeft lastIndexWhere reduce splitAt unzip | |
collect foldRight lastOption reduceLeft startsWith unzip3 | |
collectFirst forall length reduceLeftOption stringPrefix updated | |
combinations foreach lengthCompare reduceOption sum view | |
companion genericBuilder lift reduceRight tail withFilter | |
compose groupBy map reduceRightOption tails zip | |
contains grouped mapConserve repr take zipAll | |
containsSlice hasDefiniteSize max reverse takeRight zipWithIndex | |
copyToArray head maxBy reverseIterator takeWhile | |
copyToBuffer headOption min reverseMap to | |
corresponds indexOf minBy reverse_::: toArray | |
scala> a.fi[11G[K[10G[Kfi | |
filter filterNot find | |
scala> a.fil[12G[K[11G[K[10G[Kfilter | |
filter filterNot | |
scala> a.filter | |
<console>:12: error: missing arguments for method filter in trait TraversableLike; | |
follow this method with `_' if you want to treat it as a partially applied function | |
a.filter | |
^ | |
scala> // https://sites.google.com/site/scalajp/home/documentation/scala-by-example/chapter10 | |
scala> // for内包表記 | |
scala> // リスト内包表記じゃない | |
scala> // http://hakobe932.hatenablog.com/entry/2014/02/01/125421 | |
scala> // http://www.scala-lang.org/old/node/111 | |
scala> a.fo[11G[K[10G[Kfo | |
fold foldLeft foldRight forall foreach | |
scala> a.fo[11G[K[10G[Kfo | |
fold foldLeft foldRight forall foreach | |
scala> a.fo[8G[K// http://www.scala-lang.org/old/node/111[8G[Ka.fold[13G[K[12G[K[11G[K[10G[Kfold | |
fold foldLeft foldRight | |
scala> a.fold | |
def fold[A1 >: A](z: A1)(op: (A1, A1) => A1): A1 | |
scala> a.foldLeft[17G[K[16G[K[15G[K[14G[K[13G[K[12G[K[11G[K[10G[KfoldLeft | |
def foldLeft[B](z: B)(f: (B, A) => B): B | |
scala> a.foldLeftRight[22G[K[21G[K[20G[K[19G[K[18G[K[17G[K[16G[K[15G[K[14G[KRight[18G[K[17G[K[16G[K[15G[K[14G[K[13G[K[12G[K[11G[K[10G[KfoldRight | |
def foldRight[B](z: B)(op: (A, B) => B): B | |
scala> a.foldRight[18G[K[17G[K[16G[K[15G[K[14G[K[13G[K[12G[K[11G[K[10G[Kfold(0)((z, n) => z + n) | |
res28: Int = 45 | |
scala> a | |
res29: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9) | |
scala> // http://www.ne.jp/asahi/hishidama/home/tech/scala/collection/method.html#fold | |
scala> a. | |
++ count indexOfSlice mkString runWith toBuffer | |
++: diff indexWhere nonEmpty sameElements toIndexedSeq | |
+: distinct indices orElse scan toIterable | |
/: drop init padTo scanLeft toIterator | |
:+ dropRight inits par scanRight toList | |
:: dropWhile intersect partition segmentLength toMap | |
::: endsWith isDefinedAt patch seq toSeq | |
:\ exists isEmpty permutations size toSet | |
addString filter isInstanceOf prefixLength slice toStream | |
aggregate filterNot isTraversableAgain product sliding toString | |
andThen find iterator productArity sortBy toTraversable | |
apply flatMap last productElement sortWith toVector | |
applyOrElse flatten lastIndexOf productIterator sorted transpose | |
asInstanceOf fold lastIndexOfSlice productPrefix span union | |
canEqual foldLeft lastIndexWhere reduce splitAt unzip | |
collect foldRight lastOption reduceLeft startsWith unzip3 | |
collectFirst forall length reduceLeftOption stringPrefix updated | |
combinations foreach lengthCompare reduceOption sum view | |
companion genericBuilder lift reduceRight tail withFilter | |
compose groupBy map reduceRightOption tails zip | |
contains grouped mapConserve repr take zipAll | |
containsSlice hasDefiniteSize max reverse takeRight zipWithIndex | |
copyToArray head maxBy reverseIterator takeWhile | |
copyToBuffer headOption min reverseMap to | |
corresponds indexOf minBy reverse_::: toArray | |
scala> a. | |
++ count indexOfSlice mkString runWith toBuffer | |
++: diff indexWhere nonEmpty sameElements toIndexedSeq | |
+: distinct indices orElse scan toIterable | |
/: drop init padTo scanLeft toIterator | |
:+ dropRight inits par scanRight toList | |
:: dropWhile intersect partition segmentLength toMap | |
::: endsWith isDefinedAt patch seq toSeq | |
:\ exists isEmpty permutations size toSet | |
addString filter isInstanceOf prefixLength slice toStream | |
aggregate filterNot isTraversableAgain product sliding toString | |
andThen find iterator productArity sortBy toTraversable | |
apply flatMap last productElement sortWith toVector | |
applyOrElse flatten lastIndexOf productIterator sorted transpose | |
asInstanceOf fold lastIndexOfSlice productPrefix span union | |
canEqual foldLeft lastIndexWhere reduce splitAt unzip | |
collect foldRight lastOption reduceLeft startsWith unzip3 | |
collectFirst forall length reduceLeftOption stringPrefix updated | |
combinations foreach lengthCompare reduceOption sum view | |
companion genericBuilder lift reduceRight tail withFilter | |
compose groupBy map reduceRightOption tails zip | |
contains grouped mapConserve repr take zipAll | |
containsSlice hasDefiniteSize max reverse takeRight zipWithIndex | |
copyToArray head maxBy reverseIterator takeWhile | |
copyToBuffer headOption min reverseMap to | |
corresponds indexOf minBy reverse_::: toArray | |
scala> a.[8G[Ka | |
res30: List[Int] = List(1, 2, 3, 4, 5, 6, 7, 8, 9) | |
scala> a.max[12G[K[11G[K[10G[Kmax | |
max maxBy | |
scala> a.max | |
res31: Int = 9 | |
scala> a.max[12G[K[11G[Kin | |
res32: Int = 1 | |
scala> a.min[12G[K[11G[Kever[14G[K[13G[K[12G[K[11G[K[10G[Krever[14G[K[13G[K[12G[K[11G[K[10G[Kreverse | |
reverse reverseIterator reverseMap reverse_::: | |
scala> a.reverse | |
res33: List[Int] = List(9, 8, 7, 6, 5, 4, 3, 2, 1) | |
scala> // maximumとminimumのScala[8G[9G[10G[11GHmaximumとminimumのScala[12GamaximumとminimumのScala[13GsmaximumとminimumのScala[14GkmaximumとminimumのScala[15GemaximumとminimumのScala[16GlmaximumとminimumのScala[17GlmaximumとminimumのScala[18GのmaximumとminimumのScala[19G[40G | |
scala> // は、minとmax | |
scala> def maximum(xs: Seq[Int]): Int = { | |
| xs.foldLeft(xs.head)((z, n) => if (z < n) n else z) | |
| } | |
maximum: (xs: Seq[Int])Int | |
scala> }[8G[K xs.foldLeft(xs.head)((z, n) => if (z < n) n else z)[1A[8G[K[K[B[2K[Adef maximum(xs: Seq[Int]): Int = { | |
| def maximum(xs: Seq[Int]): Int = {[8G[K}[8G[K xs.foldLeft(xs.head)((z, n) => if (z < n) n else z)[3G[2G[1G[1A[57G[56G[55G[54G[53G[52G[51G[50G[49G[48G[47G[46G[45G[44G[43G[42G[41G[40G[39G[38G[37G[36G[35G[34G[33G[32G[31G[30G[29G[28G[27G[26G[27G[28G[29G[30G[29G((z, n) => if (z < n) n else z)[K[1A[29G[28G((z, n) => if (z < n) n else z )[K[1A[28G[27G((z, n) => if (z < n) n else z) [K[1A[27G[26G((z, n) => if (z < n) n else z)[K[26G[25G((z, n) => if (z < n) n else z)[K[25G[24G((z, n) => if (z < n) n else z)[K[24G[23G((z, n) => if (z < n) n else z)[K[23G[22G((z, n) => if (z < n) n else z)[K[22G[21G((z, n) => if (z < n) n else z)[K[21G[20G((z, n) => if (z < n) n else z)[K[20G[19G((z, n) => if (z < n) n else z)[K[19G[18G((z, n) => if (z < n) n else z)[K[18G[17G((z, n) => if (z < n) n else z)[K[17G[16G((z, n) => if (z < n) n else z)[K[16G[15G((z, n) => if (z < n) n else z)[K[15G[14G((z, n) => if (z < n) n else z)[K[14G[13G((z, n) => if (z < n) n else z)[K[13Gr((z, n) => if (z < n) n else z)[14Ge((z, n) => if (z < n) n else z)[15G ((z, n) => if (z < n) n else z)[16G[15Gd ((z, n) => if (z < n) n else z)[16Gu ((z, n) => if (z < n) n else z)[17G[16G ((z, n) => if (z < n) n else z)[K[16G[15G ((z, n) => if (z < n) n else z)[K[15G[14G ((z, n) => if (z < n) n else z)[K[14G[13G ((z, n) => if (z < n) n else z)[K[13G[Kredu[16G[K[15G[K[14G[K[13G[KreduceLeft()[24G()[25G))[26G[25Gz))[26G,))[27G ))[28Gn))[29G[30G )[31G=)[32G>)[33G )[34Gi)[35Gf)[36G )[37G()[38Gz)[39G )[40G<)[41G )[42Gn)[43G))[44G )[45Gn)[46G )[47Ge)[48Gl)[49Gs)[50Ge)[51G )[52Gz)[53G[54G | |
| } | |
maximum: (xs: Seq[Int])Int | |
scala> maximum [15G[K((1 to 9)) | |
res34: Int = 9 | |
scala> maximum((1 to 9))[24G[23G[8G[K// reduceはfoldの初期値無指定版 | |
scala> // reduceはfoldの初期値無指定版[8G[Kmaximum((1 to 9))[8G[K}[8G[K xs.reduceLeft((z, n) => if (z < n) n else z)[8G xs.reduceLeft((z, n) => if (z < n) n else z)[K[8Gxs.reduceLeft((z, n) => if (z < n) n else z)[K[8Gs.reduceLeft((z, n) => if (z < n) n else z)[K[8G.reduceLeft((z, n) => if (z < n) n else z)[K[8GreduceLeft((z, n) => if (z < n) n else z)[K[8G(reduceLeft((z, n) => if (z < n) n else z)[9G1reduceLeft((z, n) => if (z < n) n else z)[10G,reduceLeft((z, n) => if (z < n) n else z)[11G[10GreduceLeft((z, n) => if (z < n) n else z)[K[10G[9GreduceLeft((z, n) => if (z < n) n else z)[K[9G[8GreduceLeft((z, n) => if (z < n) n else z)[K[8GLreduceLeft((z, n) => if (z < n) n else z)[9GireduceLeft((z, n) => if (z < n) n else z)[10GsreduceLeft((z, n) => if (z < n) n else z)[11GtreduceLeft((z, n) => if (z < n) n else z)[12G(reduceLeft((z, n) => if (z < n) n else z)[13G1reduceLeft((z, n) => if (z < n) n else z)[14G,reduceLeft((z, n) => if (z < n) n else z)[15G3reduceLeft((z, n) => if (z < n) n else z)[16G,reduceLeft((z, n) => if (z < n) n else z) [1A[17G4reduceLeft((z, n) => if (z < n) n else z )[1A[18G,reduceLeft((z, n) => if (z < n) n else z)[1A[19G5reduceLeft((z, n) => if (z < n) n else z)[1A[20G,reduceLeft((z, n) => if (z < n) n els e z)[1A[21G2reduceLeft((z, n) => if (z < n) n el se z)[1A[22G)reduceLeft((z, n) => if (z < n) n e lse z)[1A[23G[8G[9G[10G[11G[12G[13G[14G[15G[16G[17G[18G[19G[20G[21G[22G[23G.reduceLeft((z, n) => if (z < n) n else z)[1A[24G[1B[8G | |
res35: Int = 5 | |
scala> List(1,3,4,5,2).reduceLeft((z, n) => if (z < n) n else z)[1A[8G[9G[10G[11G[12G[13G[14G[15G[16G[17G[18G[19G[20G[21G[22G[23G[24G[25G[26G[27G[28G[29G[30G[31G[32G[33G[34G[33G((z, n) => if (z < n) n e lse z)[K[1A[33G[32G((z, n) => if (z < n) n el se z)[K[1A[32G[31G((z, n) => if (z < n) n els e z)[K[1A[31G[30G((z, n) => if (z < n) n else z)[K[1A[30G[1B[4G | |
res36: Int = 5 | |
scala> List(1,3,4,5,2).reduce((z, n) => if (z < n) n else z)[1A[8G[9G[10G[11G[12G[13G[14G[15G[16G[17G[18G[19G[20G[21G[22G[23G[24G[25G[26G[27G[28G[29G[30GL((z, n) => if (z < n) n els e z)[1A[31Ge((z, n) => if (z < n) n el se z)[1A[32Gf((z, n) => if (z < n) n e lse z)[1A[33Gt((z, n) => if (z < n) n else z)[1A[34G[33G((z, n) => if (z < n) n e lse z)[K[1A[33G[32G((z, n) => if (z < n) n el se z)[K[1A[32G[31G((z, n) => if (z < n) n els e z)[K[1A[31G[30G((z, n) => if (z < n) n else z)[K[1A[30G[29G((z, n) => if (z < n) n else z)[K[1A[29Ge((z, n) => if (z < n) n else z)[1A[30GR((z, n) => if (z < n) n els e z)[1A[31Gi((z, n) => if (z < n) n el se z)[1A[32Gg((z, n) => if (z < n) n e lse z)[1A[33Gh((z, n) => if (z < n) n else z)[1A[34Gt((z, n) => if (z < n) n else z)[1A[35G[1B[9G | |
res37: Int = 5 | |
scala> a.med[12G[K[11G[K[10G[K | |
++ indexOf reverseMap | |
++: indexOfSlice reverse_::: | |
+: indexWhere runWith | |
/: indices sameElements | |
:+ init scan | |
:: inits scanLeft | |
::: intersect scanRight | |
:\ isDefinedAt segmentLength | |
addString isEmpty seq | |
aggregate isInstanceOf size | |
andThen isTraversableAgain slice | |
apply iterator sliding | |
applyOrElse last sortBy | |
asInstanceOf lastIndexOf sortWith | |
canEqual lastIndexOfSlice sorted | |
collect lastIndexWhere span | |
collectFirst lastOption splitAt | |
combinations length startsWith | |
companion lengthCompare stringPrefix | |
compose lift sum | |
contains map tail | |
containsSlice mapConserve tails | |
copyToArray max take | |
copyToBuffer maxBy takeRight | |
corresponds min takeWhile | |
count minBy to | |
diff mkString toArray | |
distinct nonEmpty toBuffer | |
drop orElse toIndexedSeq | |
dropRight padTo toIterable | |
dropWhile par toIterator | |
endsWith partition toList | |
exists patch toMap | |
filter permutations toSeq | |
filterNot prefixLength toSet | |
find product toStream | |
flatMap productArity toString | |
flatten productElement toTraversable | |
fold productIterator toVector | |
foldLeft productPrefix transpose | |
foldRight reduce union | |
forall reduceLeft unzip | |
foreach reduceLeftOption unzip3 | |
genericBuilder reduceOption updated | |
groupBy reduceRight view | |
grouped reduceRightOption withFilter | |
hasDefiniteSize repr zip | |
head reverse zipAll | |
headOption reverseIterator zipWithIndex | |
scala> a. | |
++ indexOf reverseMap | |
++: indexOfSlice reverse_::: | |
+: indexWhere runWith | |
/: indices sameElements | |
:+ init scan | |
:: inits scanLeft | |
::: intersect scanRight | |
:\ isDefinedAt segmentLength | |
addString isEmpty seq | |
aggregate isInstanceOf size | |
andThen isTraversableAgain slice | |
apply iterator sliding | |
applyOrElse last sortBy | |
asInstanceOf lastIndexOf sortWith | |
canEqual lastIndexOfSlice sorted | |
collect lastIndexWhere span | |
collectFirst lastOption splitAt | |
combinations length startsWith | |
companion lengthCompare stringPrefix | |
compose lift sum | |
contains map tail | |
containsSlice mapConserve tails | |
copyToArray max take | |
copyToBuffer maxBy takeRight | |
corresponds min takeWhile | |
count minBy to | |
diff mkString toArray | |
distinct nonEmpty toBuffer | |
drop orElse toIndexedSeq | |
dropRight padTo toIterable | |
dropWhile par toIterator | |
endsWith partition toList | |
exists patch toMap | |
filter permutations toSeq | |
filterNot prefixLength toSet | |
find product toStream | |
flatMap productArity toString | |
flatten productElement toTraversable | |
fold productIterator toVector | |
foldLeft productPrefix transpose | |
foldRight reduce union | |
forall reduceLeft unzip | |
foreach reduceLeftOption unzip3 | |
genericBuilder reduceOption updated | |
groupBy reduceRight view | |
grouped reduceRightOption withFilter | |
hasDefiniteSize repr zip | |
head reverse zipAll | |
headOption reverseIterator zipWithIndex | |
scala> a.mi[11G[K[10G[Kmin | |
min minBy | |
scala> a.min | |
def min[B >: A](implicit cmp: scala.math.Ordering[B]): A | |
scala> a.min[12G[K[11G[K[10G[Kmin | |
min minBy | |
scala> a.min[12G[K[11G[K[10G[Km[10G[Km | |
map mapConserve max maxBy min minBy mkString | |
scala> a.m[10G[Km | |
map mapConserve max maxBy min minBy mkString | |
scala> a.m[10G[Kave[12G[Ke[8G[K3[[9G[K[8G[K// defとvalでjavapして比較してみる | |
scala> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment